Results 1 to 7 of 7
  1. #1
    twiggy62's Avatar
    twiggy62 is offline Member
    Join Date
    Feb 2010
    Posts
    26
    Rep Power
    0

    Default Can you run files without a package?

    I have a bunch of old .java files that I have created in the past and I used cmd
    to compile them. But since then that computer no longer works and and my
    new computer apparently has problems with me trying to set up cmd to work
    with the compiling of the files. So I installed NetBeans. :)

    Like if I use: file>open file>example.java

    Is there anyway to run a java file with building a package for it?
    The biggest room in the world, is room for improvement.

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

    Default

    Quote Originally Posted by twiggy62 View Post
    I have a bunch of old .java files that I have created in the past and I used cmd
    to compile them. But since then that computer no longer works and and my
    new computer apparently has problems with me trying to set up cmd to work
    with the compiling of the files. So I installed NetBeans. :)
    ...
    You should have added the path to your JDK's bin folder to your environment's PATH variable.


    Quote Originally Posted by twiggy62 View Post
    ..

    Is there anyway to run a java file with building a package for it?
    Do you mean without building a package?
    Why don't you want to put the classes in a package?

    You'll need to study the buttons on your Netbeans tool bar to find out how to run a class.

    Basically you are trying to avoid learning things that you should be learning.

    1.)First you couldn't figure out how to set the PATH correctly to include javac and java. Instead of reading and learning about it, you switched to an IDE.

    2.)Now you think Netbeans requires classes to be in packages and are avoiding learning about packages by asking how to run without declaring them.
    3.) Well, how to do that requires that you learn how to use Netbeans.

  3. #3
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    if you dont wanna create package, it will go on default package. But it is still a package.

  4. #4
    twiggy62's Avatar
    twiggy62 is offline Member
    Join Date
    Feb 2010
    Posts
    26
    Rep Power
    0

    Default

    Actually, I do know how to set my path to refer to the java and javac, cause I
    did it on my other computer just fine. I made a batch file that consisting of:

    "path = %path%,C:\Program Files (x86)\Java\jdk1.6.0_17\bin"

    so that it properly would refer to java and javac files (which are located in this
    bin. Then I would change my directory to the folder with all my java files are
    located, but still received errors when trying to compile, saying: that it did not
    recognize the java or javac.

    Maybe it's because I am using a Mac with parallels to link to my Windows
    side, (I did notice VS2008, had issues with this as well, but I got that
    resolved).

    Well, thanks, I'll just keep working with NetBeans, it is much better than
    compiling with cmd anyways.
    The biggest room in the world, is room for improvement.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    Do you have a JDK installed on your Mac then?

  6. #6
    twiggy62's Avatar
    twiggy62 is offline Member
    Join Date
    Feb 2010
    Posts
    26
    Rep Power
    0

    Default

    Yes, I do have the jdk installed on my Mac, but on the Windows OS side of my Mac, but that shouldn't matter if I am using cmd from Windows right?
    The biggest room in the world, is room for improvement.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

Similar Threads

  1. Replies: 7
    Last Post: 11-09-2009, 07:51 AM
  2. Replies: 5
    Last Post: 03-21-2009, 05:19 PM
  3. working with files (text files)
    By itaipee in forum New To Java
    Replies: 1
    Last Post: 02-24-2009, 11:38 AM
  4. Behaving text files like binary files
    By Farzaneh in forum New To Java
    Replies: 2
    Last Post: 08-27-2008, 03:20 PM
  5. how to convert mpeg files to .wav files
    By christina in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 04:14 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
  •