Wrox Programmer Forums
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2007, 12:28 PM
Authorized User
 
Join Date: Jun 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default hi

hi
I am new to java programmer.
I am using win xp professional sp2.
I installed j2sdk1.4.1_03 to c drive(windows drive).
i set path as:::::
path = ...........;c:\j2sdk1.4.1_03\bin

i save one java program in my documents as "MyProg1.java".
i opened the command prompt having default path as:::
c:\documents and settings\administrator>

i type javac MyProg.java at commanfd prompt...
i got message as:::: 'class' or 'interface' expected

unable to understand why i am getting this message?????
plse anyone help me????
waiting for ur help????



 
Old June 26th, 2007, 08:16 AM
Authorized User
 
Join Date: Oct 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi :)
Are you sure your java program has right syntax. I mean error type which you've got java specific.

Try the same for code which is below

-----------------------------------

class Hello {
public static void main(String [] args) {

System.out.println("Hello");
}

}

-----------------------------------

save this as Hello.java file in any folder(for example in D:/JavaProject), then from the command promt go to that folder ---D:/JavaProject> --- and use your javac command.

Think, this will work.

Write if any problems (or if it works :) )

Best,
Anna
 
Old June 26th, 2007, 04:12 PM
Authorized User
 
Join Date: Jun 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by annienell
 Hi :)
Are you sure your java program has right syntax. I mean error type which you've got java specific.

Try the same for code which is below

-----------------------------------

class Hello {
public static void main(String [] args) {

System.out.println("Hello");
}

}

-----------------------------------

save this as Hello.java file in any folder(for example in D:/JavaProject), then from the command promt go to that folder ---D:/JavaProject> --- and use your javac command.

Think, this will work.

Write if any problems (or if it works :) )

Best,
Anna



.................................................. ....

programming syntax were correct.

I tried ur method.
compilation was done correctly
(d:\java project> javac hello.java)
errors occurs during execution
as i type
d:\java project>java hello
follwing errors appeared::::::

exception in thread "main" java.lang.NoClassdefFoundError : hello<wrong name : hello>

at java.lang.classloader...............
...............
................

what should i do now????

ur advice is heartly accepted??????




 
Old June 27th, 2007, 12:17 AM
Authorized User
 
Join Date: Oct 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Notice that your classname starts with capital "H". As I've understood you try to call your class with "h".

Try the following call:

d:\java project>java Hello
 
Old June 27th, 2007, 05:57 AM
Authorized User
 
Join Date: Jun 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by annienell
 Notice that your classname starts with capital "H". As I've understood you try to call your class with "h".

Try the following call:

d:\java project>java Hello

.................................................. ..

thnx dear .....it worked......
thnx a lot.....


 
Old August 16th, 2008, 01:55 PM
Registered User
 
Join Date: Aug 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ch.venki Send a message via MSN to ch.venki Send a message via Yahoo to ch.venki
Default

hi,

i think its asking jar file path for java. First u give the jar file path as CLASSPATH.For this u already creat path. like that u create CLASSPATH as java/lib. i think u'r problem will solved.

Hope this can help.
ch.venki









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.