Results 1 to 8 of 8
  1. #1
    Unclejunebug is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default Code compiles in/runs in IDE but not on UNIX system

    Hello All!

    I'm new here and hopefully I'm posting this in the proper section. If not, please let me know. I've searched this forum as well as others and have not been able to find a working solution.

    I have a program I've been working on in Eclipse that compiles and runs just fine on my laptop. The problem I'm having is that I need to run the program on a UNIX system as well, but for some reason when I try and compile on the UNIX system I get the "cannot find symbol" error when making instantiations of objects that are defined in seperate java files from the main file.

    My first thought was that the files are not being seen as being in the same package. I'm not that familiar with how packages would work on a UNIX system, but my understanding is that placing all java files of a certain package within a directory with the same package name is the proper method.

    Can anyone enlighten me on how this works or how I can get my program to compile? Thanks!

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

  3. #3
    Unclejunebug is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default

    Thanks for the link! There's some quality info there that from what I can tell, I've followed with my files. I have four .java files in a directory named "infixProgram." The first line in each .java file in that directory is "package infixProgram." All the classes are public so I shouldn't have any issues instantiating objects of the other .java files that aren't main. But I still have the same issue.

    I tried defining the classpath but after following the format given for UNIX I get the message "Too many arguments."

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You are obviously not following all the suggested instructions. Read more about classpath.

  5. #5
    Unclejunebug is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default

    Well, I'm also not fully understanding all the technical writing in those instructions. I got around the problem by consolidating all the classes to one file and removing the package line from the code. Works great now.

  6. #6
    Unclejunebug is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default

    side note: Removing the "package name" line at the beginning of each separate .java file and specifying the classpath in the compile command also works fine.

  7. #7
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    except that it's highly discouraged to use the default package

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Better read more about packages and classpath. That silly hack won't get you very far.

Similar Threads

  1. uploadfile to unix system
    By sudheeranumolu in forum Web Frameworks
    Replies: 0
    Last Post: 05-22-2009, 07:43 AM
  2. Compiles in Netbeans, error in textpad
    By Npcomplete in forum New To Java
    Replies: 2
    Last Post: 11-21-2008, 04:50 AM
  3. Program Compiles but Buttons do not display
    By ljk8950 in forum AWT / Swing
    Replies: 8
    Last Post: 08-11-2008, 03:41 AM
  4. Accessing unix system using java
    By abhishek.sinha in forum AWT / Swing
    Replies: 3
    Last Post: 06-19-2008, 08:05 AM
  5. Errors driving me crazy! although compiles fine
    By irishsea2828 in forum New To Java
    Replies: 1
    Last Post: 04-08-2008, 03:23 PM

Posting Permissions

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