Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-02-2008, 09:52 AM
Member
 
Join Date: Apr 2008
Posts: 2
agouzoul is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-02-2008, 10:05 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,581
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Classpath is the path to where your JDK instalation can be found. Not the working folder. Something like this,

Quote:
c:\programme\jboss\lib;
c:\programme\j2sdk1.4.2_08\lib;
c:\programme\j2sdk1.4.2_08\jre\lib; .........
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-02-2008, 01:12 PM
Member
 
Join Date: Apr 2008
Posts: 2
agouzoul is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command line argument denisatandi New To Java 3 06-15-2008 07:59 AM
calling linux command line in java fangzhong New To Java 0 02-03-2008 05:24 PM
Exporting from the command line o1121 Eclipse 1 08-09-2007 08:29 PM
Unable to execute command line command in java LordSM New To Java 1 08-08-2007 01:23 AM
Java Command Line Arguments In Eclipse IDE JavaForums Eclipse 0 05-19-2007 10:45 AM


All times are GMT +3. The time now is 08:12 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org