Page 2 of 2 FirstFirst 12
Results 21 to 37 of 37
  1. #21
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Cannot find class symbols
    What program give this message?
    When posting error messages, please copy and paste them. Don't edit the text or makeup descriptions. The error message text is important to solving the problem.

  2. #22
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by ruerric View Post
    Changed my JFAGS to:

    JFLAGS = -g -sourcepath ~/Desktop/attachments_2010_06_07/ClassSched/src/classsched

    Still no luck.. still getting the Cannot find class symbols.
    Can you show us the exact error message(s)? btw are those classes in packages?

    kind regards,

    Jos

  3. #23
    ruerric is offline Member
    Join Date
    May 2010
    Posts
    19
    Rep Power
    0

    Default

    Java Code:
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ make
    javac	-g -sourcepath /Desktop/attachments_2010_06_07/ClassSched/src/classschedMain.java
    Main.java:168: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
        public static Course readCourses(String[] n) {
                      ^
    Main.java:194: cannot find symbol
    symbol  : class Rooms
    location: class classsched.Main
        public static Rooms readRooms(String[] n) {
                      ^
    Main.java:19: cannot find symbol
    symbol  : class Rooms
    location: class classsched.RoomCapacityComparator
            int room1Cap = ((Rooms) room1).getCap();
                             ^
    Main.java:21: cannot find symbol
    symbol  : class Rooms
    location: class classsched.RoomCapacityComparator
            int room2Cap = ((Rooms) room2).getCap();
                             ^
    Main.java:39: cannot find symbol
    symbol  : class Course
    location: class classsched.CourseCapacityComparator
            int course1Cap = ((Course) course1).getCap();
                               ^
    Main.java:41: cannot find symbol
    symbol  : class Course
    location: class classsched.CourseCapacityComparator
            int course2Cap = ((Course) course2).getCap();
                               ^
    Main.java:61: cannot find symbol
    symbol  : class Rooms
    location: class classsched.Main
                List<Rooms> roomsList = new ArrayList<Rooms>(); // List implemented as growable array
                     ^
    Main.java:61: cannot find symbol
    symbol  : class Rooms
    location: class classsched.Main
                List<Rooms> roomsList = new ArrayList<Rooms>(); // List implemented as growable array
                                                      ^
    Main.java:62: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
                List<Course> classList = new ArrayList<Course>();
                     ^
    Main.java:62: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
                List<Course> classList = new ArrayList<Course>();
                                                       ^
    Main.java:63: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
                List<Course> classListcopy = new ArrayList<Course>();
                     ^
    Main.java:63: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
                List<Course> classListcopy = new ArrayList<Course>();
                                                           ^
    Main.java:65: cannot find symbol
    symbol  : class CSVReader
    location: class classsched.Main
                CSVReader classReader = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file.
                ^
    Main.java:65: cannot find symbol
    symbol  : class CSVReader
    location: class classsched.Main
                CSVReader classReader = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file.
                                            ^
    Main.java:90: cannot find symbol
    symbol  : class CSVReader
    location: class classsched.Main
                CSVReader roomsReader = new CSVReader(new FileReader("classrooms.csv"));    //Uses the CSVReader to read in the "classrooms.csv" file.
                ^
    Main.java:90: cannot find symbol
    symbol  : class CSVReader
    location: class classsched.Main
                CSVReader roomsReader = new CSVReader(new FileReader("classrooms.csv"));    //Uses the CSVReader to read in the "classrooms.csv" file.
                                            ^
    Main.java:101: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
                    Course aClass = classList.get(x);
                    ^
    Main.java:103: cannot find symbol
    symbol  : class Rooms
    location: class classsched.Main
                        Rooms aRoom = roomsList.get(y);//Using the object class function through the list
                        ^
    Main.java:114: cannot find symbol
    symbol  : class CSVReader
    location: class classsched.Main
                CSVReader classReadercopy = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file.
                ^
    Main.java:114: cannot find symbol
    symbol  : class CSVReader
    location: class classsched.Main
                CSVReader classReadercopy = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file.
                                                ^
    Main.java:169: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
            Course aCourse = new Course();
            ^
    Main.java:169: cannot find symbol
    symbol  : class Course
    location: class classsched.Main
            Course aCourse = new Course();
                                 ^
    Main.java:195: cannot find symbol
    symbol  : class Rooms
    location: class classsched.Main
            Rooms aRoom = new Rooms();
            ^
    Main.java:195: cannot find symbol
    symbol  : class Rooms
    location: class classsched.Main
            Rooms aRoom = new Rooms();
                              ^
    24 errors
    make: *** [Main.class] Error 1
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$
    That is the error code I receive when I try to execute my makefile

    When I try and run my java after doing Javac Main.java Course.java Rooms.java CSVReader.java CSVParser.java

    I executed three different tried.. java Main, java main, and java classsched.Main
    Java Code:
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java Main
    Exception in thread "main" java.lang.NoClassDefFoundError: Main (wrong name: classsched/Main)
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: Main.  Program will exit.
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java main
    Exception in thread "main" java.lang.NoClassDefFoundError: main
    Caused by: java.lang.ClassNotFoundException: main
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: main.  Program will exit.
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java classsched.Main
    Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main
    Caused by: java.lang.ClassNotFoundException: classsched.Main
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: classsched.Main.  Program will exit.
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$
    These are my error codes

  4. #24
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    It appears that your Main class is in the package: classsched
    Are the other classes also in packages?
    Does the classpath point to the folder containing the classsched folder?
    Are all the classes in that package in the classsched folder?

    To execute the program go to the folder containing the classsched folder that contains all the class files and enter:
    java classsched.Main

  5. #25
    ruerric is offline Member
    Join Date
    May 2010
    Posts
    19
    Rep Power
    0

    Default

    I just spoke to my professor, and I explained to him that makefile for Java is outdated, and what is currently being used is Ant.. he states that as long as it can run and execute in a linux environment I will be fine.. are there any applications that can automate the process?

    Or maybe a better start is.. how to execute my files correctly.. I have already compiled it with no errors.. and have the files I need in a .class file.. executing it with the commands java main, java Main, or java classsched.Main (classsched is the package name) gives me errors

  6. #26
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Using a package, you need to backup the folders used in package path to be in a folder where java can find the class files.

  7. #27
    ruerric is offline Member
    Join Date
    May 2010
    Posts
    19
    Rep Power
    0

    Default

    Java Code:
    Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main
    Caused by: java.lang.ClassNotFoundException: classsched.Main
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: classsched.Main.  Program will exit.
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ 
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$
    Yes, the other classes are in packages, package classsched
    Yes, the classpath is JFLAGS = -g -sourcepath /Desktop/attachments_2010_06_07/ClassSched/src/classsched

    Yes, lal the classes in the package are in the classsched folder

  8. #28
    ruerric is offline Member
    Join Date
    May 2010
    Posts
    19
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Using a package, you need to backup the folders used in package path to be in a folder where java can find the class files.
    I am a bit confused by how to do this..

    If I am in a terminal where the path is suppose to be suppose
    .../src/classsched/ is where all of my .class and .java is.. and i am also executing my java from here.. do I need to create a copy of classsched and place that copy inside the ..../src/classsched/ directory?

  9. #29
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    You left off the command line. Need to see the location and the command that was issued.
    Is Main in a package?
    Is the Main.class file in: /Desktop/attachments_2010_06_07/ClassSched/src/classsched
    If so go to: /Desktop/attachments_2010_06_07/ClassSched/src/
    and issue: java classsched.Main

  10. #30
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Sorry. By backup I meant moving UP the folder chain to the parent folder. The one that contains the classsched folder.

  11. #31
    ruerric is offline Member
    Join Date
    May 2010
    Posts
    19
    Rep Power
    0

    Default

    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java classsched.Main

  12. #32
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Your in the wrong folder. Unless there is a folder named classsched in the classsched folder you are currently in. Can you do a "cd .." to move up one level?

  13. #33
    ruerric is offline Member
    Join Date
    May 2010
    Posts
    19
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    You left off the command line. Need to see the location and the command that was issued.
    Is Main in a package?
    Is the Main.class file in: /Desktop/attachments_2010_06_07/ClassSched/src/classsched
    If so go to: /Desktop/attachments_2010_06_07/ClassSched/src/
    and issue: java classsched.Main
    Yes, Main is in the package classsched;
    The name of main is Main.java

    Java Code:
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ ls
    classsched  opencsv-2.2
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ cd classsched/
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ ls
    classrooms.csv  CSVParser.java~  Main.java~  Rooms.java~     test.csv
    Course.java     CSVReader.java   makefile    spring2010.csv
    Course.java~    CSVReader.java~  makefile~   spring.csv
    CSVParser.java  Main.java        Rooms.java  springtest.csv
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java classsched.Main
    Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main
    Caused by: java.lang.ClassNotFoundException: classsched.Main
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: classsched.Main.  Program will exit.
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ cd ..rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ ls
    classsched  opencsv-2.2
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ java classsched.Main
    Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main
    Caused by: java.lang.ClassNotFoundException: classsched.Main
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: classsched.Main.  Program will exit.
    rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$

  14. #34
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Where are the .class files? Your ls command only show .java files. And a few .csv

  15. #35
    ruerric is offline Member
    Join Date
    May 2010
    Posts
    19
    Rep Power
    0

    Default

    wow I'm embarassed. it must have gone away after I was experimenting with the makefile and I ran make clean. I went into the ../src/ folder and executed java classsched.Main and it ran. But there was an error in the code with finding the text files.. I'm going to try and work with this for a quick second

    Edit 1**
    okay, I have a question.. Using the CSVReader.java and CSVParser.java.. they were originally in another package,
    rob@rob-laptop:~/Desktop/ex/ClassSched/src$ ls
    classsched opencsv-2.2

    They were taken from opencsv-2.2 and I pulled out the files.. how can I compile my project while keeping the files within that other package?

    Edit 2**
    Alright, I decided to strip the CSVReader.java and CSVParser.java completely from its original package..
    I replaced their original package with package classsched
    I removed the folder csv2.2
    I am still able to build and run my program successfully within Netbeans.. which is outputting a file called "assignments.csv"
    But fter compiling with no errors, then running the program on the Linux environment, my program catches the "File Not Found exception".. any reason why it would work on Netbeans and not while running it on Linux?

    Edit 3**
    I got it to fully run and compile! I had to bring the .csv files outside to where /src/ is so I can see classsched directory, and the csv files.. Now I need to learn how to compile it with makefile..
    Last edited by ruerric; 06-10-2010 at 11:59 PM.

  16. #36
    sir_endrik is offline Member
    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    Default

    probably too late for you ruerric, but I think you just need to take the $ away from *.java in the 2nd line below:

    .java.class:
    $(JC) $(JFLAGS) *.java

  17. #37
    sir_endrik is offline Member
    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    Default

    probably too late for you ruerric, but I think you just need to take the $ away from *.java in the 2nd line below:


    .java.class:
    $(JC) $(JFLAGS) $*.java

    ...change it to...

    .java.class:
    $(JC) $(JFLAGS) *.java

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Linux Shell
    By rp181 in forum Advanced Java
    Replies: 2
    Last Post: 01-30-2010, 04:51 AM
  2. MakeFile
    By divyanshu023 in forum New To Java
    Replies: 1
    Last Post: 09-18-2009, 08:16 AM
  3. Running Linux
    By selva.bics in forum AWT / Swing
    Replies: 1
    Last Post: 08-31-2009, 07:01 PM
  4. Replies: 6
    Last Post: 04-08-2009, 04:05 AM
  5. Help regarding makefile problem
    By rams in forum Networking
    Replies: 0
    Last Post: 11-17-2008, 03:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •