Having problems compiling
I have jdk1.3.1 and just downloaded it to upgrade from jdk1.1.8. I also have the recent j2se program. I have bought a book from the year 2002 and have installed jdk1.3.1 from it. I was trying to compile an example from the book but It gave me an error. I think I have gotten everything classpathed correctly.
Here is how I classpathed it:
path
set CLASSPATH= .;C:\jdk1.3.1\lib\servlet.jar ; C:\j2sdkee1.4\lib\j2ee.jar
Heres the example from the book untouched:
// WebBrowser.java
// WebBrowser is an application for browsing Web sites using
// a WebToolBar and WebBrowserPane.
package com.deitel.advjhtp1.gui.webbrowser;
// Java core packages
import java.awt.*;
import java.awt.event.*;
import java.net.*;
// Java extension packages
import javax.swing.*;
import javax.swing.event.*;
public class WebBrowser extends JFrame {
private WebToolBar toolBar;
private WebBrowserPane browserPane;
// WebBrowser constructor
public WebBrowser()
super( "Deitel Web Browser" );
// create WebBrowserPane and WebToolBar for navigation
browserPane = new WebBrowserPane();
toolBar = new WebToolBar( browserPane );
// lay out WebBrowser components
Container contentPane = getContentPane();
contentPane.add( toolBar, BorderLayout.NORTH );
contentPane.add( new JScrollPane( browserPane ),
BorderLayout.CENTER );
// execute application
public static void main( String args[] )
WebBrowser browser = new WebBrowser();
browser.setDefaultCloseOperation( EXIT_ON_CLOSE );
browser.setSize( 640, 480 );
browser.setVisible( true );
}Maybe someone could try to compile the source code to see if It isn't my compiler or the way I set it up?
I put the source code in the bin directory and then go to the command prompt, go to jdk1.3.1\bin, then type in javac WebBrowser.java
Am I using the right jdk? I also have tried it with the sdk and get the same errors.
Theres something wrong and can't figure it out.
If anyone could help me figure this out that would be great.
Thanks in advance
George
Hi,
Firstly, you could eliminate the package declaration for now since it will compile in a default package. The book may have used package declaration based on the way the authors have written the code.
// WebBrowser.java
// WebBrowser is an application for browsing Web sites
using
// a WebToolBar and WebBrowserPane.
package com.deitel.advjhtp1.gui.webbrowser;
Secondly, this class also uses two other classes - WebToolBar and WebBrowserPane - to add in this JFrame. Post that code as well, for us to execute the app.
public class WebBrowser extends JFrame {
private WebToolBar toolBar;
private WebBrowserPane browserPane;
Similar Messages
-
I've been trying to do the tutorials in a book titled Apache Jakarta-Tomcat as part of my introduction to JSP. I'm new to Java but do know the basics. I have on my machine Java 1.3, Java 1.4, Java FrameWorks 2.1 and Jython 2.1 on Win2000 Pro. So enough about my configuration. I have never worked with packages also.
I downloaded the files from the books site due to the fact I make a lot of typos when hand coding Java (I've become a pretty good debugger of my own code). But everytime I go to compile the *.java I get error messages. So below you will find HelloTag.java and beneath that the error messages that are thrown when I try and compile it. I tested other bits of *.java and have had no problem compiling them. Is there a JSP module I'm missing?
Am I doing something wrong or am I missing something from my configuration.
Marijan Madunic
package chapter2;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
public class HelloTag extends TagSupport
public void HelloTag() {
// Method called when the closing hello tag is encountered
public int doEndTag() throws JspException {
try {
// We use the pageContext to get a Writer
// We then print the text string Hello
pageContext.getOut().print("Hello");
catch (Exception e) {
throw new JspTagException(e.getMessage());
// We want to return SKIP_BODY because this Tag does not support
// a Tag Body
return SKIP_BODY;
public void release() {
// Call the parent's release to release any resources
// used by the parent tag.
// This is just good practice for when you start creating
// hierarchies of tags.
super.release();
D:\Java\JDK 1.3\bin>javac HelloTag.java
HelloTag.java:3: cannot resolve symbol
symbol : class JspException
location: package jsp
import javax.servlet.jsp.JspException;
^
HelloTag.java:4: cannot resolve symbol
symbol : class JspTagException
location: package jsp
import javax.servlet.jsp.JspTagException;
^
HelloTag.java:5: cannot resolve symbol
symbol : class TagSupport
location: package tagext
import javax.servlet.jsp.tagext.TagSupport;
^
HelloTag.java:7: cannot resolve symbol
symbol : class TagSupport
location: class chapter2.HelloTag
public class HelloTag extends TagSupport
^
HelloTag.java:14: cannot resolve symbol
symbol : class JspException
location: class chapter2.HelloTag
public int doEndTag() throws JspException {
^
HelloTag.java:20: cannot resolve symbol
symbol : variable pageContext
location: class chapter2.HelloTag
pageContext.getOut().print("Hello");
^
HelloTag.java:24: cannot resolve symbol
symbol : class JspTagException
location: class chapter2.HelloTag
throw new JspTagException(e.getMessage());
^
HelloTag.java:28: cannot resolve symbol
symbol : variable SKIP_BODY
location: class chapter2.HelloTag
return SKIP_BODY;
^
HelloTag.java:37: cannot resolve symbol
symbol : variable super
location: class chapter2.HelloTag
super.release();
^
9 errorsWell, it looks like you've not got the servlet development kit JAR on your classpath. I think it'll probably be called servlet.jar on your system. Add that to the classpath if it's not already there.
Incidentally, you've bumped into one of the areas Java's slightly lenient - declaring a method that looks like a constructor:
public HelloTag() { }
public void HelloTag() { }The first is a constructor, the second is a normal method. I'm assuming you intended to have the former instead of the latter.
Anyway, hope this helps. -
Having problems compiling script
I am rather new to java an started a couple of days ago and I ran into a problem compiling this script in the command line
class VariableDemo {
public static void main (String args[]) {
int num = 1000;
System.out.println (num + " is the value of num") ;
At first I forgot to capitolize the 'S' in System (which is why I was getting errors) but after I had corrected it , I still could not get it to compile in a command prompt
even after I corrected my mistakes, I still get this error:
error: cannot read: VariableDemo.java
1 error
When I ran it through JCreator it compiled it just fine and found no errors. SO I just want to know if it is some thing that has to do with the command line or is there an error I am not seeing?
I am running Windows XP Pro with service pack 2 and using JCreator 3.50.010Sorry, I am new to this I just called it script out of ignorance, but, yes it is in the same directory. I even Pathed it out again to be sure.
-
Just downloaded jGRASP, and having problems compiling...
I just downloaded jGRASP, and I am having trouble compiling my code. I think I might need to download some compiler, but im not sure what exactly to download (in order to properly compile and run my coude) and where to get it. thanks for your help!
Please refrain from cross-posting (posting the same thread into multiple forums).
Thank you.
http://forum.java.sun.com/thread.jspa?threadID=770482&tstart=0 -
Just learning EJB - having problems compiling
I'm trying to learn EJB by going through the Sun J2EE tutorial. When trying to compile the converter example I get the following error messages:
E:\MostlyJava\j2eetutorial\examples>ant converter
Buildfile: build.xml
init:
converter:
[javac] Compiling 4 source files to E:\MostlyJava\j2eetutorial\examples\buil
d\ejb\converter
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\Converter.java
:10: cannot resolve symbol
[javac] symbol : class EJBObject
[javac] location: package ejb
[javac] import javax.ejb.EJBObject;
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\Converter.java
:14: cannot resolve symbol
[javac] symbol : class EJBObject
[javac] location: interface Converter
[javac] public interface Converter extends EJBObject {
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
java:11: cannot resolve symbol
[javac] symbol : class SessionBean
[javac] location: package ejb
[javac] import javax.ejb.SessionBean;
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
java:12: cannot resolve symbol
[javac] symbol : class SessionContext
[javac] location: package ejb
[javac] import javax.ejb.SessionContext;
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
java:15: cannot resolve symbol
[javac] symbol : class SessionBean
[javac] location: class ConverterBean
[javac] public class ConverterBean implements SessionBean {
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
java:37: cannot resolve symbol
[javac] symbol : class SessionContext
[javac] location: class ConverterBean
[javac] public void setSessionContext(SessionContext sc) {}
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
java:12: cannot resolve symbol
[javac] symbol : class CreateException
[javac] location: package ejb
[javac] import javax.ejb.CreateException;
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
java:13: cannot resolve symbol
[javac] symbol : class EJBHome
[javac] location: package ejb
[javac] import javax.ejb.EJBHome;
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
java:15: cannot resolve symbol
[javac] symbol : class EJBHome
[javac] location: interface ConverterHome
[javac] public interface ConverterHome extends EJBHome {
[javac] ^
[javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
java:17: cannot resolve symbol
[javac] symbol : class CreateException
[javac] location: interface ConverterHome
[javac] Converter create() throws RemoteException, CreateException;
[javac] ^
[javac] 10 errors
BUILD FAILED
E:\MostlyJava\j2eetutorial\examples\build.xml:89: Compile failed, messages shoul
d have been provided.
Total time: 2 secondsThanks, for your reply the problem was with the classpath, even though it appears that the ant script points to it I had to set it in the environment.
-
Still having problems compiling java code
I still dont know what is wrong, it works just fine in JCreator but, when I try to use the command prompt it still gives me the same error message. Also I have made sure that the code is in the same directory with the command.
Thanks for the advice Kitty, that was the command I
was using javac <FileName.java>. I did, however,
update my classpath and the path variables like you
mentioned, but I am still recieving the same error
message. I just cannot figure out where the error in
the code is. =(Okay... apparently you need a little help...
So to help you clarify thing a bit...
Let's start here...
This error below...
C:\myfolder\test>javac VariableDemo.java
'javac' is not recognized as an internal or external command,
operable program or batch file.... is what you get if the OS does not know the path to javac.exe...
if you type path at the command prompt you will see what your "System" path is, which would include an entry that would point to you sdk, something like "C:\YourJavaSDKFolder\bin";C:\someotherprogramfolder;
This path has nothing to do with the classpath. Your system uses this path to find executables to run you programs ( although many are locations are actually in your registry an therefore no path entry is needed... i.e. MS Word )...
This error...
C:\myfolder\test>javac VariableDemo.java
error: cannot read: VariableDemo.java
1 errormeans that your compiler was not able to locate your *.java file. I was able to replicate because VariableDemo.java does not exist on my machine, so javac.exe naturally could not find the *.java file...
javac.exe does not check the "System" path to find class files, so even though you saved you file in your "bin" folder of the SDK, javac would not know it there...
the way that javac.exe is able to find you class files is either by the default "." as stated before which is your current working directory
( noted by your command prompt ... C:\myfolder\test> )
or if you had specified your classpath either as an argument...
C:\>javac -classpath c:\myfolder\test VariableDemo.javaor by setting the "classpath" environment variable either temporarily in you command prompt by typing
set classpath=c:\myfolder\testor setting as you "System" environment variable by ( assuming Win XP though it similar for NT and 2000 ) via System Properties|Advance Tab|Environment Variable... Read your OS documentation for details involving setting your Environment Variable...
as for why JCreator or what ever IDE you are using is able to do it, is because, part of what it does is temporarily pass the classpath information to the compiler automatically... so that you won't need to do it... and which is why IDE are generally not recommended to beginners to learn Java... It does to much stuff you... hence you classpath issue...
anyway, check out the links provided for you for further and more detail information on setting the "classpath" on other Java basic...
- MaxxDmg...
- ' He who never sleeps... ' -
Having problem compiling JAXP - SAX example
I am new to this technology. I am trying to run all the examples which are in JWSDP1.1. Can anybody tell How to solve the following error.
C:\jwsdp-1.1\docs\tutorial\examples\jaxp\sax\samples>javac Echo01.java
Echo01.java:74: cannot resolve symbol
symbol : method parse (java.io.File,org.xml.sax.helpers.DefaultHandler)
location: class javax.xml.parsers.SAXParser
saxParser.parse( new File(argv[0]), handler);
^
1 errorIn the command line include these files:
sax.jar
jaxp-api.jar
I mean like this :
javac -classpath ......\sax.jar;.....\jaxp-api.jar Echo01.java -
Problem compiling Abstract class
Hi
I have writting an abstract class Sort.java and another class BubbleSort.java. I am having problems compiling BubbleSort.java class.
The following is the error message
BubbleSort.java:8: missing method body, or declare abstract
public int doSorting(int[] array);
^
BubbleSort.java:11: return outside method
return num;
^
The following is the code
public abstract class Sort
public abstract int doSorting(int[] array);
}// End of class
public class BubbleSort extends Sort
private int num = 2;
public int doSorting(int[] array);
num = num + 2;
return num;
} // end of classRemove the semi-colon.
public int doSorting(int[] array); // <------- there -
Problems compiling Zaptel package [SOLVED-ISH]
Hey guys, I'm on an Arch64 system and I'm having problems compiling Zaptel (a dependancy for Asterisk).
Here's the pastebin of the errors I get from the Zaptel makefile: http://pastebin.com/776475
Here's my analysis so far:
There's a line in the Makefile for the zaptel driver that goes like this:
make -C /lib/modules/2.6.17-ARCH/build/ SUBDIRS=/home/woogie/zaptel/src/zaptel-1.2.8 modules
This line activates the kernel's makefile in order to build modules, but specifies that the source directory for zaptel should be included in the make process.
Then things go down the proverbial drain - linux/err_kernel_only.h gets included in the build process, which is designed to do one thing only - stop the build process. So I'm not entirely too sure what's going on here. Is there something misconfigured on my system, or is the Zaptel build system flawed somehow, such that I need to compensate for it?Further information:
I've manually run the problematic make command from /lib/modules/2.6.17-ARCH/build on my own. After reading the kernel makefile documentation, I've learned of the V=1 flag to show me exactly what's going on. The failing command is this one:
gcc -Wp,-MD,/home/cestus/zaptel/src/zaptel-1.2.8/.zaptel.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/include -D__
KERNEL__ -Iinclude -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O2
-fomit-frame-pointer -m64 -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -fun
it-at-a-time -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wdeclaration-after-statement -Wno-pointer-sign -I. -Iinclude -O4 -g -Wall -DBUILDING_T
ONEZONE -m64 -DSTANDALONE_ZAPATA -DZAPTEL_CONFIG="/etc/zaptel.conf" -DHOTPLUG_FIRMWARE -I/home/cestus/zaptel/src/zaptel-1.2.8//include
-I/home/cestus/zaptel/src/zaptel-1.2.8//include/oct6100api -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(zaptel)" -D"KBUIL
D_MODNAME=KBUILD_STR(zaptel)" -c -o /home/cestus/zaptel/src/zaptel-1.2.8/zaptel.o /home/cestus/zaptel/src/zaptel-1.2.8/zaptel.c
I've figured out that the bit which causes the failure is "-include include/linux/autoconf.h", because autoconf.h just includes the "err_kernel_only" header automatically, which then slays the build process. And I've also discovered that the Zaptel devs are uber-leet. They've found the magical -O4 level in gcc. You know, the one above 3, where the supported optimization levels in gcc are -O, -Os, -O2 and -O3 -
i'm new to java, just went through the tutorial just now..
tried compilling my program the first time on XP, but the system doesn't recognise the command JAVAC,
i've installed the java compiler (j2re-1_4_1_01-windows-i586.exe)
but it still isn't working.. any help?
thanks!then again.. i'm still having problems compiling..
i managed to install the right sdk, but.. i have to run the command javac from the bin directory.. else the command prompt won't recognise it..
anyway to get around this?
also.. because of this.. i can't compile my program.. :( -
hello.
this is james mcfadden. i'm having problems compiling the Demo.java program. the Demo.java program is shown below along with the MediaPanel.java and MediaTest.java programs. when i compile the Demo.java program i get the following errors. i really need help in getting rid of these errors.
----jGRASP exec: javac -g X:\CP4B Project\Demo.java
Demo.java:297: cannot find symbol
symbol : class Media
location: class Demo
MediaTest media=new Media();
^
Demo.java:301: cannot find symbol
symbol : class Media
location: class Demo
MediaTest media=new Media();
^
Demo.java:305: cannot find symbol
symbol : class Media
location: class Demo
MediaTest media=new Media();
^
3 errors
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
//Written by:Seamus McFadden
//Class:CP4B
//Program Number:1
//Program Name:Demo.java
//Description:
//Supervisor:Gerard McCloskey
import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
import java.awt.event.*;//Provides interfaces and classes for dealing with different types of events fired by AWT components
import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
public class Demo extends JFrame{
public static void main(String[] args){
int choice=-1;//a variable of type int that is set to -1
choice=getChoice();//invokes the method getChoice()
if(choice!=0){
getSelected(choice);//invokes the method getSelected(choice)
}//end if
}//end main
public static int getChoice(){
String choice;//a variable of type string
int ch;//a variable of type int
choice=JOptionPane.showInputDialog(null,
"1. Product Menu\n" +
"2. Member Menu\n" +
"3. Rental Menu\n" +
"4. Media Menu\n" +
"5. Log Off\n\n" +
"Enter your choice");//asks the user for some input
ch=Integer.parseInt(choice);//a class that wraps a value of the primitive type int in an object
return ch;//a method that returns an integer value
}//end getChoice
public static void getSelected(int choice){
if(choice == 1) {
product();
}//end if
if(choice==2){
member();
}//end if
if(choice==3){
rental();
}//end if
if(choice==4){
media();
}//end if
if(choice==5){
LogOff logoff=new LogOff();
}//end if
else{
ErrorMessage error=new ErrorMessage();
}//end getSelected
public static void product(){
int productChoice=-1;//a variable of type int that is set to -1
productChoice=getProductChoice();//invokes the method getChoice()
if(productChoice!=0){
getProductSelected(productChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static void member(){
int memberChoice=-1;//a variable of type int that is set to -1
memberChoice=getMemberChoice();//invokes the method getChoice()
if(memberChoice!=0){
getMemberSelected(memberChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static void rental(){
int rentalChoice=-1;//a variable of type int that is set to -1
rentalChoice=getRentalChoice();//invokes the method getChoice()
if(rentalChoice!=0){
getRentalSelected(rentalChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static void media(){
int mediaChoice=-1;//a variable of type int that is set to -1
mediaChoice=getMediaChoice();//invokes the method getChoice()
if(mediaChoice!=0){
getMediaSelected(mediaChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static int getProductChoice(){
String productChoice;//a variable of type string
int pch;//a variable of type int
productChoice=JOptionPane.showInputDialog(null,
"1. Add product details\n" +
"2. View product details\n" +
"3. Edit product details\n" +
"4. Delete product details\n" +
"5. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
pch=Integer.parseInt(productChoice);//a class that wraps a value of the primitive type int in an object
return pch;//a method that returns an integer value
}//end getProductChoice
public static int getMemberChoice(){
String memberChoice;//a variable of type string
int mch;//a variable of type int
memberChoice=JOptionPane.showInputDialog(null,
"1. Add member details\n" +
"2. View member details\n" +
"3. Edit member details\n" +
"4. Delete member details\n" +
"5. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
mch=Integer.parseInt(memberChoice);//a class that wraps a value of the primitive type int in an object
return mch;//a method that returns an integer value
}//end getMemberChoice
public static int getRentalChoice(){
String rentalChoice;//a variable of type string
int rch;//a variable of type int
rentalChoice=JOptionPane.showInputDialog(null,
"1. Add rental details\n" +
"2. View rental details\n" +
"3. Edit rental details\n" +
"4. Delete rental details\n" +
"5. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
rch=Integer.parseInt(rentalChoice);//a class that wraps a value of the primitive type int in an object
return rch;//a method that returns an integer value
}//end getRentalChoice
public static int getMediaChoice(){
String mediaChoice;//a variable of type string
int mtch;//a variable of type int
mediaChoice=JOptionPane.showInputDialog(null,
"1. Listen to songs\n" +
"2. View movie previews\n" +
"3. View game previews\n" +
"4. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
mtch=Integer.parseInt(mediaChoice);//a class that wraps a value of the primitive type int in an object
return mtch;//a method that returns an integer value
}//end getMediaChoice
public static void getProductSelected(int productChoice){
if(productChoice==1){
addProducts();
}//end if
if(productChoice==2){
viewProducts();
}//end if
if(productChoice==3){
editProducts();
}//end if
if(productChoice==4){
deleteProducts();
}//end if
else{
ErrorMessage error=new ErrorMessage();
}//end getProductSelected
public static void getMemberSelected(int memberChoice){
if(memberChoice==1){
addMembers();
}//end if
if(memberChoice==2){
viewMembers();
}//end if
if(memberChoice==3){
editMembers();
}//end if
if(memberChoice==4){
deleteMembers();
}//end if
else{
ErrorMessage error=new ErrorMessage();
}//end getMemberSelected
public static void getRentalSelected(int rentalChoice){
if(rentalChoice==1){
addRentals();
}//end if
if(rentalChoice==2){
viewRentals();
}//end if
if(rentalChoice==3){
editRentals();
}//end if
if(rentalChoice==4){
deleteRentals();
}//end if
else{
ErrorMessage error=new ErrorMessage();
}//end getRentalSelected
public static void getMediaSelected(int mediaChoice){
if(mediaChoice==1){
hearSongs();
}//end if
if(mediaChoice==2){
viewMovies();
}//end if
if(mediaChoice==3){
viewGames();
}//end if
else{
ErrorMessage error=new ErrorMessage();
}//end getMediaSelected
public static void addProducts(){
ProductForm product=new ProductForm();
product.getInput();
product.setVisible(true);
public static void viewProducts(){
DatabaseTest tt=new DatabaseTest();
tt.setVisible(true);
public static void editProducts(){
ProductForm product=new ProductForm();
product.getInput();
product.setVisible(true);
public static void deleteProducts(){
ProductForm product=new ProductForm();
product.setVisible(true);
public static void addMembers(){
MemberForm member=new MemberForm();
member.getInput();
member.setVisible(true);
public static void viewMembers(){
DatabaseTest tt=new DatabaseTest();
tt.setVisible(true);
public static void editMembers(){
MemberForm member=new MemberForm();
member.getInput();
member.setVisible(true);
public static void deleteMembers(){
MemberForm member=new MemberForm();
member.setVisible(true);
public static void addRentals(){
RentalForm rental=new RentalForm();
rental.getInput();
rental.setVisible(true);
public static void viewRentals(){
DatabaseTest tt=new DatabaseTest();
tt.setVisible(true);
public static void editRentals(){
RentalForm rental=new RentalForm();
rental.getInput();
rental.setVisible(true);
public static void deleteRentals(){
RentalForm rental=new RentalForm();
rental.setVisible(true);
public static void hearSongs(){
MediaTest media=new Media();
public static void viewMovies(){
MediaTest media=new Media();
public static void viewGames(){
MediaTest media=new Media();
}//end class Demo
import java.awt.BorderLayout;
import java.awt.Component;
import java.io.IOException;
import java.net.URL;
import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.swing.JPanel;
public class MediaPanel extends JPanel{
public MediaPanel(URL mediaURL){
setLayout(new BorderLayout());//use a BorderLayout
//Use lightweight components for Swing compatibility
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER,true);
try{
//create a player to play the media specified in the URL
Player mediaPlayer=Manager.createRealizedPlayer(mediaURL);
//get the components for the video and the playback controls
Component video=mediaPlayer.getVisualComponent();
Component controls=mediaPlayer.getControlPanelComponent();
if(video!=null)
add(video,BorderLayout.CENTER);//add video component
if(controls!=null)
add(controls,BorderLayout.SOUTH);//add controls
mediaPlayer.start();//start playing the media clip
}//end try
catch(NoPlayerException noPlayerException){
System.err.println("No media player found");
}//end catch
catch(CannotRealizeException cannotRealizeException){
System.err.println("Could not realize media player");
}//end catch
catch(IOException iOException){
System.err.println("Error reading from the source");
}//end catch
}//end MediaPanel constructor
}//end class MediaPanel
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
public class MediaTest{
//launch the application
public static void main(String args[]){
//create a file chooser
JFileChooser fileChooser=new JFileChooser();
//show open file dialog
int result=fileChooser.showOpenDialog(null);
if(result==JFileChooser.APPROVE_OPTION){//user chose a file
URL mediaURL=null;
try{
//get the file as URL
mediaURL=fileChooser.getSelectedFile().toURL();
}//end try
catch(MalformedURLException malformedURLException){
System.err.println("Could not create URL for the file");
}//end catch
if(mediaURL!=null) {//only display if there is a valid URL
JFrame mediaTest=new JFrame("Media Tester");
mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MediaPanel mediaPanel=new MediaPanel(mediaURL);
mediaTest.add(mediaPanel);
mediaTest.setSize(300,300);
mediaTest.setVisible(true);
}//end inner if
}//end outer if
}//end main
}//end class MediaTesthello.
this is james mcfadden. thanks for the reply. i did what you told me to do, but i am still having trouble trying to use the 2 JMF programs (MediaPanel.java and MediaTest.java) with the Demo.java program. the Demo.java program compiles and runs ok, but when i press 1 (for listening to songs) in the media menu i get a JOptionPane (An Error Message) displayed on screen. how can i fix this problem?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Demo extends JFrame{
public static void main(String[] args){
int choice=-1;//a variable of type int that is set to -1
choice=getChoice();//invokes the method getChoice()
if(choice!=0){
getSelected(choice);//invokes the method getSelected(choice)
}//end if
}//end main
public static int getChoice(){
String choice;//a variable of type string
int ch;//a variable of type int
choice=JOptionPane.showInputDialog(null,
"1. Product Menu\n" +
"2. Member Menu\n" +
"3. Rental Menu\n" +
"4. Media Menu\n" +
"5. Log Off\n\n" +
"Enter your choice");//asks the user for some input
ch=Integer.parseInt(choice);//a class that wraps a value of the primitive type int in an object
return ch;//a method that returns an integer value
}//end getChoice
public static void getSelected(int choice){
if(choice == 1) {
product();
}//end if
if(choice==2){
member();
}//end if
if(choice==3){
rental();
}//end if
if(choice==4){
media();
}//end if
if(choice==5){
LogOff logoff=new LogOff();
}//end if
else{
JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
System.exit(0);
}//end getSelected
public static void product(){
int productChoice=-1;//a variable of type int that is set to -1
productChoice=getProductChoice();//invokes the method getChoice()
if(productChoice!=0){
getProductSelected(productChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static void member(){
int memberChoice=-1;//a variable of type int that is set to -1
memberChoice=getMemberChoice();//invokes the method getChoice()
if(memberChoice!=0){
getMemberSelected(memberChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static void rental(){
int rentalChoice=-1;//a variable of type int that is set to -1
rentalChoice=getRentalChoice();//invokes the method getChoice()
if(rentalChoice!=0){
getRentalSelected(rentalChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static void media(){
int mediaChoice=-1;//a variable of type int that is set to -1
mediaChoice=getMediaChoice();//invokes the method getChoice()
if(mediaChoice!=0){
getMediaSelected(mediaChoice);//invokes the method getSelected(choice)
}//end if
getChoice();
public static int getProductChoice(){
String productChoice;//a variable of type string
int pch;//a variable of type int
productChoice=JOptionPane.showInputDialog(null,
"1. Add product details\n" +
"2. View product details\n" +
"3. Edit product details\n" +
"4. Delete product details\n" +
"5. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
pch=Integer.parseInt(productChoice);//a class that wraps a value of the primitive type int in an object
return pch;//a method that returns an integer value
}//end getProductChoice
public static int getMemberChoice(){
String memberChoice;//a variable of type string
int mch;//a variable of type int
memberChoice=JOptionPane.showInputDialog(null,
"1. Add member details\n" +
"2. View member details\n" +
"3. Edit member details\n" +
"4. Delete member details\n" +
"5. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
mch=Integer.parseInt(memberChoice);//a class that wraps a value of the primitive type int in an object
return mch;//a method that returns an integer value
}//end getMemberChoice
public static int getRentalChoice(){
String rentalChoice;//a variable of type string
int rch;//a variable of type int
rentalChoice=JOptionPane.showInputDialog(null,
"1. Add rental details\n" +
"2. View rental details\n" +
"3. Edit rental details\n" +
"4. Delete rental details\n" +
"5. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
rch=Integer.parseInt(rentalChoice);//a class that wraps a value of the primitive type int in an object
return rch;//a method that returns an integer value
}//end getRentalChoice
public static int getMediaChoice(){
String mediaChoice;//a variable of type string
int mtch;//a variable of type int
mediaChoice=JOptionPane.showInputDialog(null,
"1. Listen to songs\n" +
"2. View movie previews\n" +
"3. View game previews\n" +
"4. Return to main menu\n\n" +
"Enter your choice");//asks the user for some input
mtch=Integer.parseInt(mediaChoice);//a class that wraps a value of the primitive type int in an object
return mtch;//a method that returns an integer value
}//end getMediaChoice
public static void getProductSelected(int productChoice){
if(productChoice==1){
addProducts();
}//end if
if(productChoice==2){
viewProducts();
}//end if
if(productChoice==3){
editProducts();
}//end if
if(productChoice==4){
deleteProducts();
}//end if
else{
JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
System.exit(0);
}//end getProductSelected
public static void getMemberSelected(int memberChoice){
if(memberChoice==1){
addMembers();
}//end if
if(memberChoice==2){
viewMembers();
}//end if
if(memberChoice==3){
editMembers();
}//end if
if(memberChoice==4){
deleteMembers();
}//end if
else{
JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
System.exit(0);
}//end getMemberSelected
public static void getRentalSelected(int rentalChoice){
if(rentalChoice==1){
addRentals();
}//end if
if(rentalChoice==2){
viewRentals();
}//end if
if(rentalChoice==3){
editRentals();
}//end if
if(rentalChoice==4){
deleteRentals();
}//end if
else{
JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
System.exit(0);
}//end getRentalSelected
public static void getMediaSelected(int mediaChoice){
if(mediaChoice==1){
hearSongs();
}//end if
if(mediaChoice==2){
viewMovies();
}//end if
if(mediaChoice==3){
viewGames();
}//end if
else{
JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
System.exit(0);
}//end getMediaSelected
public static void addProducts(){
ProductForm product=new ProductForm();
product.getInput();
product.setVisible(true);
public static void viewProducts(){
DatabaseTest tt=new DatabaseTest();
tt.setVisible(true);
public static void editProducts(){
ProductForm product=new ProductForm();
product.getInput();
product.setVisible(true);
public static void deleteProducts(){
ProductForm product=new ProductForm();
product.setVisible(true);
public static void addMembers(){
MemberForm member=new MemberForm();
member.getInput();
member.setVisible(true);
public static void viewMembers(){
DatabaseTest tt=new DatabaseTest();
tt.setVisible(true);
public static void editMembers(){
MemberForm member=new MemberForm();
member.getInput();
member.setVisible(true);
public static void deleteMembers(){
MemberForm member=new MemberForm();
member.setVisible(true);
public static void addRentals(){
RentalForm rental=new RentalForm();
rental.getInput();
rental.setVisible(true);
public static void viewRentals(){
DatabaseTest tt=new DatabaseTest();
tt.setVisible(true);
public static void editRentals(){
RentalForm rental=new RentalForm();
rental.getInput();
rental.setVisible(true);
public static void deleteRentals(){
RentalForm rental=new RentalForm();
rental.setVisible(true);
public static void hearSongs(){
MediaTest media=new MediaTest();
public static void viewMovies(){
MediaTest media=new MediaTest();
public static void viewGames(){
MediaTest media=new MediaTest();
}//end class Demo
import java.awt.BorderLayout;
import java.awt.Component;
import java.io.IOException;
import java.net.URL;
import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.swing.JPanel;
public class MediaPanel extends JPanel{
public MediaPanel(URL mediaURL){
setLayout(new BorderLayout());//use a BorderLayout
//Use lightweight components for Swing compatibility
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER,true);
try{
//create a player to play the media specified in the URL
Player mediaPlayer=Manager.createRealizedPlayer(mediaURL);
//get the components for the video and the playback controls
Component video=mediaPlayer.getVisualComponent();
Component controls=mediaPlayer.getControlPanelComponent();
if(video!=null)
add(video,BorderLayout.CENTER);//add video component
if(controls!=null)
add(controls,BorderLayout.SOUTH);//add controls
mediaPlayer.start();//start playing the media clip
}//end try
catch(NoPlayerException noPlayerException){
System.err.println("No media player found");
}//end catch
catch(CannotRealizeException cannotRealizeException){
System.err.println("Could not realize media player");
}//end catch
catch(IOException iOException){
System.err.println("Error reading from the source");
}//end catch
}//end MediaPanel constructor
}//end class MediaPanel
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
public class MediaTest{
//launch the application
public static void main(String args[]){
//create a file chooser
JFileChooser fileChooser=new JFileChooser();
//show open file dialog
int result=fileChooser.showOpenDialog(null);
if(result==JFileChooser.APPROVE_OPTION){//user chose a file
URL mediaURL=null;
try{
//get the file as URL
mediaURL=fileChooser.getSelectedFile().toURL();
}//end try
catch(MalformedURLException malformedURLException){
System.err.println("Could not create URL for the file");
}//end catch
if(mediaURL!=null) {//only display if there is a valid URL
JFrame mediaTest=new JFrame("Media Tester");
mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MediaPanel mediaPanel=new MediaPanel(mediaURL);
mediaTest.add(mediaPanel);
mediaTest.setSize(300,300);
mediaTest.setVisible(true);
}//end inner if
}//end outer if
}//end main
}//end class MediaTest -
Problems compiling at91 driver for samutils-0.2.1
Hello All!
I'm having problems compiling the usb driver for sam7 tools. I am receiving the following errors:
make -C /lib/modules/2.6.39-ARCH/build SUBDIRS=/home/bailey/Source/sam7utils-0.2.1/driver modules
make[1]: Entering directory `/usr/src/linux-2.6.39-ARCH'
CC [M] /home/bailey/Source/sam7utils-0.2.1/driver/at91.o
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c: In function âat91_write_bulk_callbackâ:
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:154:2: error: implicit declaration of function âusb_buffer_freeâ [-Werror=implicit-function-declaration]
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:140:19: warning: variable âdevâ set but not used [-Wunused-but-set-variable]
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c: In function âat91_writeâ:
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:178:2: error: implicit declaration of function âusb_buffer_allocâ [-Werror=implicit-function-declaration]
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:178:6: warning: assignment makes pointer from integer without a cast [enabled by default]
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:192:6: warning: passing argument 6 of âusb_fill_bulk_urbâ from incompatible pointer type [enabled by default]
include/linux/usb.h:1266:20: note: expected âusb_complete_tâ but argument is of type âvoid (*)(struct urb *, struct pt_regs *)â
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c: In function âat91_probeâ:
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:305:2: error: implicit declaration of function âinfoâ [-Werror=implicit-function-declaration]
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c: In function âat91_disconnectâ:
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:320:2: error: implicit declaration of function âlock_kernelâ [-Werror=implicit-function-declaration]
/home/bailey/Source/sam7utils-0.2.1/driver/at91.c:328:2: error: implicit declaration of function âunlock_kernelâ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [/home/bailey/Source/sam7utils-0.2.1/driver/at91.o] Error 1
make[1]: *** [_module_/home/bailey/Source/sam7utils-0.2.1/driver] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.39-ARCH'
make: *** [default] Error 2
output of uname -a
2.6.39-ARCH #1 SMP PREEMPT Mon Jun 27 22:01:13 CEST 2011 i686 Intel(R) Pentium(R) 4 CPU 1.50GHz GenuineIntel GNU/Linux
I am running gcc 4.6.1-1 and have installed kernel26headers. If there is any info I'm missing plz let me know.
Thanks for your help in advanceThank you for the reply, I noticed that the post below (its for Ubuntu) shows the gcc version to be 4.0.3
[link]http://www.makingthings.com/documentati … -sam7utils[/link]
I poked around the Makefile in /usr/src/linux-2.6.39 and got rid of "-Wall" and "-Wno-implicit-function-declaration"
it compiled with the following warnings:
make[1]: Entering directory `/usr/src/linux-2.6.39-ARCH'
Building modules, stage 2.
MODPOST 1 modules
WARNING: "info" [/home/bailey/Source/sam7utils-0.2.1/driver/at91.ko] undefined!
WARNING: "unlock_kernel" [/home/bailey/Source/sam7utils-0.2.1/driver/at91.ko] undefined!
WARNING: "lock_kernel" [/home/bailey/Source/sam7utils-0.2.1/driver/at91.ko] undefined!
WARNING: "usb_buffer_alloc" [/home/bailey/Source/sam7utils-0.2.1/driver/at91.ko] undefined!
WARNING: "usb_buffer_free" [/home/bailey/Source/sam7utils-0.2.1/driver/at91.ko] undefined!
CC /home/bailey/Source/sam7utils-0.2.1/driver/at91.mod.o
LD [M] /home/bailey/Source/sam7utils-0.2.1/driver/at91.ko
make[1]: Leaving directory `/usr/src/linux-2.6.39-ARCH'
but when I tried to install, the output was
insmod: error inserting 'at91.ko': -1 Unknown symbol in module
Unfortunately, I tried grabbing the package from the AUR, but I ran into the same issues. Seems the only common factor in this process is gcc.
Thanks for the help -
I'm having problem with exporting video from premiere pro cc 2014
I'm using Adobe Premiere Pro CC 2014 and I'm having problem with exporting video.
When I click Export and media, the window for exporting appears and it starts exporting video.
But after a few minutes, it looks like it has completed exporting video and says there's a bug in exporting.
It literally says it has a problem with compiling, but I don't know what the real problem is.
I tried many things like restarting computer and Premire Pro but it's no use.
But it works when I use Adobe Media Encoder CC 2014 for exporting video.
If anyone knows any possibilities about why this problem happens, please let me know.I'm having a similar issue. When I go to export my project, I add it to the render queue, set it up with the h.264 settings that I've used with countless past versions of the program, and then hit render. Randomly, at some point in the process, the render just stops and the ETA just keeps climbing. I actually had to save an XMF file of the CC 2014 project and bring it into the previous CC version of Premiere just to finish it. Even a clean re-install of CC 2014 doesn't work.
-
Problem compiling PL/SQL code
I am having problmes compiling the following piece of pl/sql
code:
declare
v_servicekey services.servicekey%type;
v_tmodelkey tmodels.tmodelkey%type;
l_bindingid bindingtemplates.bindingid%type;
i_rowlimit number(28);
begin
select bindingid
into l_bindingid
from
(select b.bindingid as bindingid,
b.bindingkey,
nvl(b.accesspointurltype,''),
nvl(b.accesspointurl,''),
nvl(b.hostingredirector,''),
b.updated
from bindingtemplates b, services s
where s.serviceid=b.serviceid
and s.servicekey=v_servicekey
and (b.bindingid in (select i.bindingid
from instances
i,tmodels t
where
t.tmodelid=i.tmodelid
and
t.tmodelkey=v_tmodelkey)
or (b.hostingredirector is not
null
and b.hostingredirector in
(select bindingkey
from bindingtemplates
where bindingid in (select i.bindingid
from instances i,tmodels t
where t.tmodelid = i.tmodelid
and t.tmodelkey = v_tmodelkey))))
order by b.updated)
where rownum <= i_rowlimit;
end;
I get the compilation error
ERROR at line 30:
ORA-06550: line 30, column 27:
PLS-00103: Encountered the symbol "ORDER" when expecting one of
the following:
) * & = - + < / > in mod not rem with an exponent (**)
<> or != or ~= >= <= <> and or like between group having
intersect minus start union where connect is null is not ||
is dangling year DAY_
The symbol ")" was substituted for "ORDER" to continue.
ORA-06550: line 30, column 45:
PLS-00103: Encountered the symbol ")" when expecting one of the
following:
. ( , * @ % & - + ; / for mod rem an exponent (**) asc desc
||
Obviously there is only one SQL and it is complaining about the
ORDER BY clause. Please ignore the values for the host variables.
The same SQL when run from the SQL prompt with values
substituted for the host variables runs perfectly well. Am I
missing something or is there a catch with Oracle PL/SQL.
Please enlighten.
Thankssee
http://forums.oracle.com/forums/message.jsp?id=500260
I want to know that if there is any PL/SQL commad for compiling the code?
My problem is, I am working in an environment where we are using a Database tool named TOAD of QUEST Software. Every body can look into the code. I just want to hide this code from others. A Quick reply in this regard will be really very helpful. -
Im using xcode 4.6 and im having problems reading files using the fopen function in c
Im using xcode 4.6 and im having problems reading files using the fopen function in c
Yes, but that would not cause the "build failed" message.
right I missed that part. Looks like two problems then.
// main.m
// ASCTestFopen
// Created by Frank Caggiano on 3/2/13.
// Copyright (c) 2013 Frank Caggiano. All rights reserved.
#import <Foundation/Foundation.h>
#include <stdio.h>
int main(int argc, const char * argv[])
@autoreleasepool {
FILE *fp, *fopen();
// insert code here...
if((fp = fopen("~/test.txt","r")) == NULL)
NSLog(@"open failed");
return 0;
This will compile ad run in Xcode with a project type of comand line tool
Maybe you are looking for
-
HT201412 I can't get siri to answer any questions?
I can't get siri to respond to my voice?
-
Installation and required disk space
Hi, I have just gone to install Leopard on my iBook. In the installation process when I select the hard drive on which I want to install on, it say that I need something like 6 gigs of free space. I only have 5 gigs free, so will this mean that I nee
-
Why do we use BADI (CRM_BWA_MFLOW) when we can write code in CMOD?
Hello Gurus, I'm working on CRM, BW extraction. I made enhacement for Service Order Header DataSource and written code in MFLOW BADi. Its working good. Now my question is we can write code in CMOD user exit too for this enhcenement (am I right?).
-
Importing just got very slow!
I've been running itunes great for the past year, all of a sudden I'm going from 10x-12x speed importing to 1.2x-2x. What's the deal? I've run every adware, spyware and virus scan I have and everything checks out hunky dorry. I'm too impatient to wai
-
Firefox 7.0.1 Page Load forever
Hi My Os : windows 7 ultimate sp1 (new installation) Firefox 7.0.1 Add-on: IDM CC Real -Debrid flash player showkwave java sliverlight the problem : when i brows internet Surprisingly the internet stop working and page load forever even if i open new