NetBeans IDE 4.1 & a class file

Hello, I use NetBeans IDE 4.1 to write my java programs. I've been assigned to write a program that will prompt the user for an input. To make this easier, my University has written a file called "In.java" so we can easily get any type of input from the user. For example if we want the user to enter his/her name, we would write:
System.out.println ("Please enter your name: ");
String name = In.getString(); //allows user to enter a string
The "In.java" file is supposed to be kept and compiled in the directory I'm working in. I kept it in C:\j2sdk1.4.2_09 and it works fine when I write a program in notepad but not NetBeans IDE. It does not recognize the "In.class" file. Any way to get around this? Thanks in advance.

NetBeans 4.1 is bundled with J2sdk1.5.0_04. Check your NetBeans classpath and see if it is pointing to the newer sdk.
If so, it needs to be changed to point to your older SDK...
... or, get your In.class file into the current NetBeans classpath...
... or read up on, and use the new Scanner class in the new sdk.

Similar Messages

  • Installing NetBeans IDE file unknown type

    Hello,
    Downloaded Netbeans IDE, shows up as unknown file type: 1-ML-JAVASE-WINDOWS[1]
    I have Java SDK 1.6 installed. I have been using JGrasp without problems.
    Should this file be renamed?

    Zarnon wrote:
    Ok, I tried the DL on a different computer.
    I wish I could post a screenshot. I'm using IE ver 6.0. When the file download box appears, the extension .ml-javaese-windows[1] appears and the file type is shown as 'unknown'.
    This is even before the file downloads. Use a real browser?
    www.firefox.com

  • Can't create a .class file

    Hello
    I am glade to know this forum, I bet it is muche better than my instructor, any how ..
    I am trying to do my first java program, the progam is working properly on netbeans 4.1 with jdk1.5.0, but when I go to the command prompt on windows XP it dose not work,
    other programs work in the command prompt but mine dose not
    what is good is that I know the problem, it is that I don't have the .class file I have the .java, and as I read it was supposed to be created automatically on neatbeans but unfortunatly it is not. can I creat it somehow ??!!
    any sugestions ??

    I did a google search and found this thread.
    Just to keep information at finger tips etc.
    I installed the recent JDK from JavaSun place for Windows (XP).
    I could not compile a class file from a java file in Netbeans.
    To compile a class file from a java file I needed to use javac.
    Using cmd prompt (Command prompt) I could not use Javac (I forgot about PATH vars).
    Right click my computer, properties in menu, advanced tab, Environment variables, Edit the path variable, add the directory c:\proram files\java\jdk????\bin\ (??? being the version of your jdk), then run cmd then javac works! (remembering of course to have ; seperator!)
    ADDTIONAL INFO:
    Should I set the PATH variable?
    Set the PATH variable if you want to be able to conveniently run the JDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the command. If you don't set the PATH variable, you need to specify the full path to the executable every time you run it, such as:
    C:> "\Program Files\Java\jdk1.6.0_<version>\bin\javac" MyClass.java
    It's useful to set the PATH permanently so it will persist after rebooting.
    How do I set the PATH permanently?
    To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows, according to whether you are on Microsoft Windows NT or 98/2000/ME.
    Message was edited by:
    g000we

  • Howto resolve the path to the class file

    hi @ all,
    i'm currently developing a package for ldap operations. now i want to write down all the real basic configuration for that package into a xml file which i want to save in the folder where the compiled class files are stored. my problem is that i do not know how i can resolve the absolute path to that xml file later. i mean, how can i load this file if the package is, e.g. exported as an jar file and i do not know where this jar file will be stored by the users of my package.
    can anyone help me with that please?
    thx in advance
    dialsc

    k, cool...
    looks like it goes into the right direction.
    with this statement i get the path where the jar is stored, right.
    in my current situation this is the path to the src directory which i configured my eclipse ide to store the class files under.
    let's say this path is d:\tmp\src
    my package is tdl.domain.utils.ldap
    so in fact at the moment my class files are stored under d:\tmp\src\tdl\domain\utils\ldap and the xml file too.
    first:
    that statement returns /D:/tmp/src
    as you can see it uses unix path separators. do i have to replace them with the machine specific pathSeparatorChar?
    second:
    can is simply add the path tdl\domain\utils\ldap to that one (using the according machine specific pathSeparatorChar) and will this also work when i build a jar file of my package?
    sorry for all that questions but i realy need this...
    thx
    dialsc

  • I am able to compile a java file in eclipse inspite of compilation errors shown in eclipse and a .class file is generated

    Hi,
    I had a java file with compilation errors as shown in eclipse IDE.
    But the class file is still generated in the classes folder on building and pressing clean the project.
    I confirmed that the class file has an updated time stamp and also that a System.out.println() statement that i added was indeed printed out when this class was encountered during the running of a web application in which this class was called somewhere.
    (The java class has no subclasses and it is a single class with public modifier).
    How does it happen so?
    Regards,
    Karthik.

    As far as I know, the java code is compiled in Eclipse as soon as you save it. i.e. press CTRL+SHIFT+s
    as far as the build is concerned, in case you have a build file where you specify how to make a jar file, the location the jsr file is to be placed, only then you have to build the project. However again, as far as just simple compile is concerned as soon as you save the files are compiled. And show you the errors if any in the tasks window.

  • How  to include the inner classes in a jar file in netbeans ide

    Dear java friends
    how to say to netbeans ide that it has to include the
    inner classes in the jar file.
    (i have one single applet class
    with two inner classes that show up
    in the build/classes file but not in the jar).
    The applet works in the viewer but not
    in the browser (I believe because the
    xxx$yyy etc should be in the jar)
    willemjav

    First, please stop posting the same question multiple times:
    Duplicate of http://forum.java.sun.com/thread.jspa?threadID=5269782&messageID=10127496#10127496
    with an answer.
    Second, If your problem is that you can't do this in NetBeans, you need to post to somewhere that provides NetBeans support - like the NetBeans website's mailing list. These forums do not support NetBeans (or any other IDE) - they are Java language forums.

  • How to build jms files using netbeans ide

    hi,
    i am using the latest netbeans ide to build a simple jms java file,
    but i am getting this:
    init:
    deps-jar:
    Compiling 10 source files to
    C:\wrox\pro_jms\Chapter04\Test\build\classes
    C:\wrox\pro_jms\Chapter04\AccountsDepartment.java:4: package
    javax.jms does not exist
    import javax.jms.*;
    C:\wrox\pro_jms\Chapter04\AccountsDepartment.java:11: cannot find
    symbol
    the netbeans ide i am using is jdk_1.6, which when i use directly to
    compile in command line mode, works. can anyone tell me why this is
    happening?
    thanks.

    I take it that you are trying to build a Java applicaiton that uses JMS API. To do it in netbeans using SUN OpenMQ I usually follow those steps:
    1) I create a new project
    2) I add JMS library. This is a library that I had created in netbeans using Library Manager. It consist of jms.jar ( this jar file contains the definition of JMS API). Next jar file is the implemention of the JMS API, in case of SUN OpenMQ it's imq.jar, but if you're using a different JMS provider it may be a different file. The last jar file in my JMS library is usually fscontext.jar, this jar file provides JNDI access to a file based store. Again if you're using something like ldap then it would be a different jar file.
    That's basicly it - Tom

  • Error: "Could not find the main class: Files\NetBeans"

    I am working on a WorldWind mapping application but I think this issue is more of a straight Java question. I was attempting to add a web service reference by means of the NetBeans IDE. The reference compiled as it should have but then the application would not run. I deleted the reference, commented out all the code that used the web reference, basically restored all the code to how it was before trying to add the web service. The applicaiton still will not run with the message that it can't find the main class. I do, however, get a clean build. What should I do to fix this?
    Here is the error: "Could not find the main class: Files\NetBeans"
    thanks!

    nigel25840 wrote:
    I am working on a WorldWind mapping application but I think this issue is more of a straight Java question. I was attempting to add a web service reference by means of the NetBeans IDE. The reference compiled as it should have but then the application would not run. I deleted the reference, commented out all the code that used the web reference, basically restored all the code to how it was before trying to add the web service. The applicaiton still will not run with the message that it can't find the main class. I do, however, get a clean build. What should I do to fix this?
    Here is the error: "Could not find the main class: Files\NetBeans"
    thanks!Sounds like something (a .cmd file or .bat file, perhaps) is set up to launch NetBeans with a command line like this:
    java -classpath ... c:\Program Files\NetBeans ...
    So since the path has embedded space(s) in it, it thinks you are wanting to run a class named "Files\NetBeans", which does not exist.
    You need someone there who knows what they are doing to look into it for you.

  • Import class file in default package (netbeans) into my jsp

    Hello all I have created a class file in the default package under Source Files in the netbeans 5 ide.
    I am having a problem importing that class file into my jsp(which resides in the Web Pages directory .
    I tried the following:
    <jsp:useBean id="dial" class="Test" scope="session" />
    my class file is Test.java
    Any help or explanation would be greatly appreciated.
    TIA!

    Will not work. Classes have to be defined in a package, the default package just wont do.
    ram.

  • Java Programming: Any Ideas for breaking a huge class file into smaller ?

    Hello Java pros,
    I have some very huge class files, some with dozens of methods; each method containing an average of a screen-page full of code.
    Obviously, such huge class files are difficult to maintain inspite of using an IDE, especially when changes have to be made to a bunch of a category of methods scattered all over the class.
    I am wondering if there are ways/best-practices out there to make the core class file smaller/smarter - fr eg.
    <a> by retaining the real core definitions within the core class and moving the detailed implementation outside the core class
    <b> by breaking down the file into more manageable pieces - something to the effect of using 'include' files that some languages support
    etc.
    Thanks for your help in advance.
    Sree Nidhi

    If you have huge class files with dozens of methods, maybe the design of your application is not so sound. You could use all kinds of OO design techniques to design your application so that it is easier to maintain.
    Start by learning about design patterns. The most famous book about design patterns is this one: http://www.amazon.com/exec/obidos/ASIN/0201633612/qid=1029971487/sr=2-1/ref=sr_2_1/102-4299125-5141710
    Here is also a nice book about anti-patterns: http://www.antipatterns.com/
    Jesper

  • Cannot find class CustomerFacadeRemote in NetBeans IDE 5.0 Quick Start Guid

    Hi,
    I am new to Sun Java Studio Enterprise 8.1. I am follwing NetBeans IDE 5.0 Quick Start Guide for J2EE Applications example and got two following errors:
    C:\SunStudioWS\CustomerBook\CustomerBook-war\src\java\web\CustomerDetail.java:41: cannot find symbol
    symbol : class CustomerFacadeRemote
    location: package ejb
    ejb.CustomerFacadeRemote custFacade = lookupCustomerFacadeBean();
    C:\SunStudioWS\CustomerBook\CustomerBook-war\src\java\web\CustomerDetail.java:41: cannot find symbol
    symbol : method lookupCustomerFacadeBean()
    location: class web.CustomerDetail
    ejb.CustomerFacadeRemote custFacade = lookupCustomerFacadeBean();
    2 errors
    C:\SunStudioWS\CustomerBook\CustomerBook-war\nbproject\build-impl.xml:299: The following error occurred while executing this line:
    C:\SunStudioWS\CustomerBook\CustomerBook-war\nbproject\build-impl.xml:141: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 1 second)
    Here is the code:
    * CustomerDetail.java
    * Created on July 23, 2007, 3:27 PM
    package web;
    import java.io.*;
    import java.net.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * @author yl
    * @version
    public class CustomerDetail extends HttpServlet {
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet customerDetail</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Servlet customerDetail at " + request.getContextPath () + "</h1>");
    String customerNr = request.getParameter("customer_nr");
    if((customerNr != null) && !(customerNr.equals("")))
    try{
    ejb.CustomerFacadeRemote custFacade = lookupCustomerFacadeBean();
    out.println("Customer's info for nr. " + customerNr + ": " + custFacade.getCustomerInfo(
    Integer.parseInt(customerNr)));
    }catch(javax.ejb.FinderException ex){
    out.println("Customer with nr. " + customerNr +" not found");
    out.println("<form>");
    out.println("Customer number: <input type='text' name='customer_nr' />");
    out.println("<input type=submit value=Select />");
    out.println("</form>");
    out.println("</body>");
    out.println("</html>");
    out.close();
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    // </editor-fold>
    private web.ServiceLocator serviceLocator;
    private web.ServiceLocator getServiceLocator() {
    if (serviceLocator == null) {
    serviceLocator = new web.ServiceLocator();
    return serviceLocator;
    private ejb.CustomerFacaderRemote lookupCustomerFacaderBean() {
    try {
    return ((ejb.CustomerFacaderRemoteHome) getServiceLocator().getRemoteHome("java:comp/env/ejb/CustomerFacaderBean",ejb.CustomerFacaderRemoteHome.class)).create();
    } catch(javax.naming.NamingException ne) {
    java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
    throw new RuntimeException(ne);
    } catch(javax.ejb.CreateException ce) {
    java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ce);
    throw new RuntimeException(ce);
    } catch(java.rmi.RemoteException re) {
    java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,re);
    throw new RuntimeException(re);
    Thank you very much for any help.
    ylou

    In the code you have posted, some places refer to '.CustomerFacader' while others refer to '.CustomerFacade' leading to issues.
    Also: Have you considered using NetBeans 5.5.1 as an alternative to JSE 8.1?
    http://forum.java.sun.com/thread.jspa?threadID=5192837

  • Netbeans IDE and the Jar file

    I can't find the jar file compiled by Netbeans anywhere. In the preferences it says the "dist" folder, but that returns nothing when I search my computer.
    I'm using the Mac OS X release, if that helps at all.

    I've just had a look at NetBeans (on a Windows machine). The jar file is not created until I choose "Build Main Project". At that point a helpful message appeared saying:To run this application from the command line without Ant, try:
    java -jar "C:\Documents and Settings\pbrockway.WXPD6OFF\WhereAmI\dist\WhereAmI.jar"The jar file also appears in the "Files" tab (under dist). There doesn't seem to be any way of running the jar file from the NetBeans IDE - or at least, I couldn't find it: others might be more knowledgable about this.

  • How to add class file to the project in netbean

    Hi,
    I am not sure if it is the right place to put the question. I just cannot find the way to add my existing java class file into the project in net bean.
    Anyone can help?
    Thanks a lot

    Look at the "classpath" entry on the Index tab in NB's Help. There are entries there that explain how to add existing classes and libraries to a project.

  • Program run in Netbeans but NOT running as jar file

    Dear all ,
    i hope any help in this problem.
    i am writing program to access parallel port i put next files :
    1. [ comm.jar + javax.comm.properties ] in
    [ C:\Program Files\Java\jdk1.6.0_18\lib ] and [ C:\Program Files\Java\jdk1.6.0_18\jre\lib ]
    2. [ win32com.dll ] in [ C:\WINDOWS\system32 ]
    when i run application in NetBeans IDE 6.8 work fine and every think is ok
    BUT when i produce jar file , generated jar file does not work [GUI appear but can not get ports on PC]
    - I try to set Environment Variable as next :
    CLASSPATH = .;C:\Program Files\Java\jdk1.6.0_18\lib\comm.jar
    also does not work
    any tip please ?
    Thanks in advance
    Nabil

    First of all, leave the lib and jre/lib directories of the JRE alone. Never ever touch them again. Remove any jars you have put there yourself, or better yet completely remove and reinstall the JRE to make sure you put it back in a correct state.
    After you do that, learn how to properly work with the classpath in both the IDE and the command line.
    Netbeans: you define the classpath by adding jars to the project (right click on the libraries node in the project tree to get the appropriate options).
    Command line: this depends on if you run a single class, or you invoke an executable jar.
    Single class: you use the -cp command line switch to define the classpath
    Executable jar: the jar itself defines the classpath in its META-INF/manifest.mf file. The -cp command line switch is ignored.
    Since you use Netbeans, you'll get an executable jar so make sure to learn how such a jar is structured.

  • Unable to configure Netbeans IDE for IDM

    I am trying to configure Netbeans IDE for my IDM project. I am using Netbeans 6.8 with the compatible plugin with JDK 1.6.
    For creating the project, I select Identity Manager Project and then provide the war file, that I create for my existing IDM installation(so that Netbeans IDM project is connected with my existing IDM project), and then select Configure repository later.
    When I perform Build, I get the following error.
    <Error during build>
    Indexing C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\Idm-811\custom\WEB-INF\config\custom-init-postprocess.xml
    C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\Idm-811\idm-staging\sample\admins.xml: Unexpected error parsing: com.sun.idm.idebridge.util.InternalError: com.waveset.util.InternalError:
    ==> java.lang.IllegalStateException: Error attempting to encrypt: Could not initialize class javax.crypto.SunJCE_b
    com.sun.idm.idebridge.util.InternalError: com.waveset.util.InternalError:
    ==> java.lang.IllegalStateException: Error attempting to encrypt: Could not initialize class javax.crypto.SunJCE_b
    C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\Idm-811\nbproject\nbjdk.xml:8: The following error occurred while executing this line:
    C:\Documents and Settings\Administrator\My Documents\NetBeansProjects\Idm-811\build.xml:384: Object validation failed; see object validator error output for details.
    BUILD FAILED (total time: 21 seconds)
    </Error>
    Anyone with similar issues, and workarounds would be appreciated.

    Use Netbeans 6.1 and Sun Identity Manager 8.1.1 and download plugin com-sun-idm-ide_8.1.0.20080630.nbm from http://java.net/projects/identitymanageride/downloads
    Currently i have installed it and it is working fine for me.
    OR
    re-downloaded idm ide-bundle.zip respective to your idm version and try to craete project in Netbeans 6.1 and 6.8.

Maybe you are looking for

  • Error (Error when starting a SWITCH branch) while using container operation

    HI Experts, I am using container operation step for moving internal table (ref to sflight) to workarea.The error I found in the log is ' Error when starting a SWITCH branch'.Kindly help me in finding the solution.Below are the steps and code. Result

  • 10.4.10 update, dead hardrive

    hello i have a powermac g4 mirror door. per the automatic software update, i downloaded/installed OS 10.4.10 i restarted machine and everything was running very sluggish. i decided to reboot one more time. when the machine restarted, all i got was th

  • Cloned ACS (VMware) but clone doesn't authenticate

                       Hi, I'm having an issue with a cloned vm of our ACS. We are moving it to a different location. I was able to clone it and get it back on the network, but I can't authenticate to it from any of my switches. I do have an older versio

  • My Itunes will not open in windows

      Every time I try to open Itunes I get an error message about the Microsoft Visual C++Runtime Library

  • Possible to sync iphone calendar over to iCal?

    I manage my calendar/contacts through outlook at work (active sync to iPhone), and would like a copy of them on my iMac. Is it possible to copy them off my iphone and over to iCal/Contacts? I did a quick search and couldn't find anything. thanks