Results 1 to 3 of 3

Thread: JRE can't see java.util.List

  1. #1
    Join Date
    Feb 2010
    Posts
    2

    angry JRE can't see java.util.List

    Dear All,
    Please help me ASAP if u can...

    I have a very strange problem, I created a very small java project containing only one class, this class contains only a main method having a System.out.println("Hello");


    I generated a jar file for this project to be able to run this jar on a linux environment and it already run succesfully using the follwing command
    java -cp myJar.jar test.MyClass

    The PROBLEM now is when I ONLY add this line to the class "import java.util.ArrayList;" and generate the jar and execute the same command, unfortunately, it gives me Exception in thread "main" java.lang.NoClassDefFoundError: test/MyClass

    UNBELIVABLE !!!!!

    please note that I am using eclipse to compile with a JRE version 1.6.0_02 and the java version running on linux is jre1.5.0_09

    Please Please help me ASAP, I have been trying to fix this problem 2 days ago and no way to solve it..

    Thanks in advance

  2. #2
    Join Date
    Feb 2010
    Posts
    136

    Re: JRE can't see java.util.List

    Hello,
    Your program contains the classes which are packed in jdk, the version which you are using. So, when you compile and run from the terminal you are in the java folder , that is where you have installed java. So, when you run it from there it finds the classes in the corresponding package and runs them. Now when you create a jar file, it finds for the classes that you have used. For jar file not running there may be two cases
    1) The class path is not set properly, that is the environment variable.
    2) The jar file which you are testing on the Linux system, java may not be installed on that system.

  3. #3
    Join Date
    Feb 2010
    Posts
    2

    ohmy Re: JRE can't see java.util.List

    First of all, Thanks for your reply,


    But Unfortunately both cases are not correct, the class path is set correctly in the environment variables, and the second case is not correct because I tried to compile that code from another computer and generated a jar from that computer, & the jar works fine on the linux environment, so 100% the problem is in my machine.

    BTW, I compared the classpath environment variable in both machines I found them the same



    Thanks In advance ....

Similar Threads

  1. Problem using Java.util.Timer
    By Gokul20 in forum Software Development
    Replies: 7
    Last Post: 09-09-2010, 10:20 PM
  2. Error "java.util.Arrays.mergeSort (Unknown Source)"
    By Fragant in forum Software Development
    Replies: 7
    Last Post: 09-09-2010, 10:18 PM
  3. Random number using java.util
    By New ID in forum Software Development
    Replies: 5
    Last Post: 10-02-2010, 02:22 AM
  4. Formatting time using java.util
    By Remedy in forum Software Development
    Replies: 5
    Last Post: 09-02-2010, 03:21 AM
  5. Link List Example in Java Sample program in Java
    By trickson in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 08:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,556,284.42576 seconds with 17 queries