Results 1 to 3 of 3
Thread: Java command line
- 04-02-2008, 08:52 AM #1
Member
- Join Date
- Apr 2008
- Posts
- 2
- Rep Power
- 0
Java command line
Hello to everyone,
I decided to post this thread in this forum and not in Eclipse because I am new to Java and this question is technically not an eclipse one :)
So here is the question:
I compile and run this program in Eclipse and it works perfect.
I am trying to incorporate it in another application by means of a comand line interface ... the application has means of sending a command to a cmd command
interpreter and executing it. When I try and test this on the command line I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: myclass (wrong name: com/example/java/swiss/myclass)
I thought this could be due to my environment not being set-up correctly. So added the following to my CLASSPATH and PATH:
PATH
C:\Work\Java Work Space\src\com\example\java\swiss;C:\Work\Java Work Space
CLASSPATH
C:\Work\Java Work Space\TonerWebService\lib; <==== where the class (in a jar file) my program is calling is located
C:\Work\Java Work Space\TonerWebService\lib\com.example.java.swiss.H ttpConnection.jar; <==== the jar itself
C:\Work\Java Work Space\TonerWebService\classes\com\example\java\swi ss <==== where the compiled class (main) is located
I also tried the following and get the same error.
Java -cp "C:\Work\Java Work Space\TonerWebService\lib;C:\Work\Java Work Space\TonerWebService\lib\com.example.java.swiss.H ttpConnection.jar" myclass
I also included -jar "<PATH TO JAR>" but without success.
Do you have any idea as to where I am going wrong? Is there anything I am missing???
Is there any where in Eclipse you can capture the java command line that the IDE executes to run myclass .. perhaps some log file or a way that this command line can be generated within the IDE??
thanks
Agouzoul
- 04-02-2008, 09:05 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Classpath is the path to where your JDK instalation can be found. Not the working folder. Something like this,
c:\programme\jboss\lib;
c:\programme\j2sdk1.4.2_08\lib;
c:\programme\j2sdk1.4.2_08\jre\lib; .........
- 04-02-2008, 12:12 PM #3
Member
- Join Date
- Apr 2008
- Posts
- 2
- Rep Power
- 0
Classpath
Many thanks Eranga...
My class path already has the followings but did not incluce them in my previous pot:
C:\Archivos de programa\Java\jre1.5.0_08\lib;
C:\Archivos de programa\Java\jre1.5.0_08\bin
So yes I have the path to the JRE included as well and get the same error.
Regards
Agouzoul
Similar Threads
-
Command line argument
By denisatandi in forum New To JavaReplies: 8Last Post: 10-16-2012, 11:37 PM -
calling linux command line in java
By fangzhong in forum New To JavaReplies: 0Last Post: 02-03-2008, 04:24 PM -
Exporting from the command line
By o1121 in forum EclipseReplies: 1Last Post: 08-09-2007, 07:29 PM -
Unable to execute command line command in java
By LordSM in forum New To JavaReplies: 1Last Post: 08-08-2007, 12:23 AM -
Java Command Line Arguments In Eclipse IDE
By JavaForums in forum EclipseReplies: 0Last Post: 05-19-2007, 09:45 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks