Java doubts

150 pts.
Tags:
Java
i started learning java rite now..i had copied the java software folder frm my lab and pasted it on my laptop...but then when i try to compile a program in the cmd prompt it says javac file not found.usage javac <options> <source files>....when i tried the same program on my desktop pc it works properly..is the problem related to the operating system...coz i have vista in my laptop and XP in my desktop....

Answer Wiki

Thanks. We'll let you know when a new response is added.

I don’t think it is a problem related to the operating system. I think it has something to do with your directories structure.
The message says “file not found”, so I would think that the source files you are trying to compile are not in the same folder or directory that you are at the time of the command execution.

“javac” can run in whatever directory you are if you set you path environment variable correctly, but this is not true for source files, so you need to be sure you are in the right directory, or in any case, make sure to specify the full path in the source file name.

Hope this helps.

Discuss This Question: 12  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Ibru
    i am learning java now. while i listening classes our sir told that we will declare arrays in bot a[ ] and [ ]a. But i am unable to understand what is different between them.
    10 pointsBadges:
    report
  • Renju
    basically there is no diff b/w both. eg: int a[ ]; is a way of declaring an integer array. int[ ] a; is another way. its not int [ ]a. [ ] thing should be close to int. its all about ease of understanding. int[ ] a, by watching itself you can simply say that 'a' is a reference to an array of integers.
    10 pointsBadges:
    report
  • Shabb
    hii my database is in mysql and i design GUI in java.i had done all database operations and its work fine on local system but when i connect to my database online it gives me error that databasename.tablename does'nt exist. why is it so happening plz anybody explain me and whats the solution for that.
    10 pointsBadges:
    report
  • carlosdl
    Shabb, you should create a new question as your problem has nothing to do with the original question in this thread, and your comment might not get the appropriate attention. When posting your new question, provide as much details as possible.
    69,160 pointsBadges:
    report
  • ITKE
    Thanks for looking out, Carlos! :)
    344,995 pointsBadges:
    report
  • NEWJAVA
    i have a problem of running java programs... When i try to run the java programs i get like this Exception in thread "main" java.lang.UnsupportedClassVersionError: H (Unsupported major.minor version 50.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) I try to find out the solution for this but i didnt succeed UnsupportedClassversionError means that older version of jvm is accessing the higher version of java .i.e., the native method of old JVM is not comaptable with the newer version. In command prompt i had find the version is java version "1.4.2_03" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02) Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode) but i have installed JDK 1.6 version I try to find whether the JVM is there or not in my computer by typing the command JVIEW but it is not there by saying not recognised. I updated the Java version with the latest one from java website but still the same above problem persists to me please find out the solutuion to me and reply to my mail bablu08041987@gmail.com
    30 pointsBadges:
    report
  • Vinoddoubts
    Hi, Usually when we use setBounds() method to position a component in a frame along with setting the setLayout() method as null. I do this in a JFrame container and executed successfully. Next I tried this in a JPanel container and an object of this class is created in the previos JFrame class. But the components of JPanel class are not displaying on execution. The code is given below. import java.awt.*; import java.awt.event.*; import javax.swing.*; class Administrator extends JFrame implements ActionListener { public Administrator() { setTitle("Administration"); setSize(500,500); setDefaultCloseOperation(EXIT_ON_CLOSE); //setLayout(new FlowLayout(FlowLayout.CENTER)); setLayout(null); /*Menubar*/ JMenuBar menubar=new JMenuBar(); /*Menus*/ JMenu patientmenu=new JMenu("Patient"); JMenu deptmenu=new JMenu("Department"); /*Menu Items*/ JMenuItem newreg=new JMenuItem("New Registry.."); JMenuItem optoip=new JMenuItem("Add as InPatient.."); JMenuItem patinfo=new JMenuItem("Patient Information"); patinfo.add(new JSeparator()); JMenuItem addapp=new JMenuItem("Add Appoinment"); JMenuItem viewdepts=new JMenuItem("View Departments"); JMenuItem adddept=new JMenuItem("Add Department.."); adddept.add(new JSeparator()); patientmenu.add(newreg); patientmenu.add(optoip); patientmenu.add(patinfo); deptmenu.add(addapp); deptmenu.add(viewdepts); deptmenu.add(adddept); newreg.addActionListener(this); optoip.addActionListener(this); patinfo.addActionListener(this); addapp.addActionListener(this); viewdepts.addActionListener(this); adddept.addActionListener(this); menubar.add(patientmenu); menubar.add(deptmenu); setJMenuBar(menubar); JButton newbutton=new JButton(" New.. "); newbutton.addActionListener(this); add(newbutton); newbutton.setBounds(10,10,100,25); setVisible(true); } public static void main(String arg[]) { new Administrator(); } public void actionPerformed(ActionEvent ae) { String act=(String)ae.getActionCommand(); if(act.equals("New Registry..")||act.equals(" New.. ")) { regPanel rgpnl=new regPanel(); rgpnl.arrangeComponents(); add(rgpnl); repaint(); setVisible(true); } } } class regPanel extends JPanel { Label namelab,agelab,sexlab,addresslab; JTextField name,age; JTextArea address; JButton do_register; JComboBox sex; public regPanel() { //Container = get (); setLayout(null); namelab=new Label("Name :"); agelab=new Label("Age :"); sexlab=new Label("Sex :"); addresslab=new Label("Address :"); name=new JTextField(20); age=new JTextField(3); address=new JTextArea(5,15); do_register=new JButton(" Register "); sex=new JComboBox(); sex.addItem("Male"); sex.addItem("Female"); add(namelab); add(name); add(agelab); add(age); add(sexlab); add(sex); add(addresslab); add(address); add(do_register); } public void arrangeComponents() { Dimension size; size=namelab.getPreferredSize(); namelab.setBounds(20,10,size.width,size.height); name.getPreferredSize(); name.setBounds(150,10,size.width,size.height); do_register.setBounds(10,10,100,25); repaint(); } } Here the components of JPanels class such as namelab, name,do_register are not displaying on execution while the newbutton is. Please help.. Thanks in advance..
    10 pointsBadges:
    report
  • shiva3322
    i dont think the problem related to operating system.As a java programmer u need to know that the java is platform independent. so that it can run in any operating system.But the problem that javac is not recognised for the java beginners is common.It is that the path for the java is not set. to set the path go to my computer icon and right click on it and go for properties-> in that -> advanced tool-> environment variables ->class path exists if not path exists.at the begining u can paste the java path.that u dont get any error during compilation
    660 pointsBadges:
    report
  • Rinsa
    [...] Java doubts [...]
    0 pointsBadges:
    report
  • Ram2006pro
    Unable to download the Docx from Applciation Server JBOSS and OS is CentOS and DB is Oracle String primary_key = Lib.getSingleResult("SELECT upload_ticket_seq.nextval FROM DUAL", "", con); pstmt = con.prepareStatement(sInsert); pstmt.setString(1, master_key); pstmt.setString(2, primary_key); pstmt.setString(3, file_name); pstmt.executeUpdate(); pstmt.close(); // select the row to update the BLOB column pstmt = con.prepareStatement(sSelect); pstmt.setString(1, primary_key); rset = pstmt.executeQuery(); if (rset.next()) { blob = ((OracleResultSet) rset).getBLOB(1); } else { status = "Error when extracting BLOB"; } blob.trim(0); out = blob.getBinaryOutputStream(); out.flush(); out.write(dataBytes, startPos, (endPos - startPos)); out.close(); Saving the Document(Docx) as BLOB Object into Database. Client Machine is Windows XP/Windows 7 and ie7 /ie8
    10 pointsBadges:
    report
  • Javahtml
    solve tis progrm, it shows the compile time error as Z:>javac poly.java poly.java:24: cannot find symbol symbol : constructor sum() location: class sum { ^ 1 error import java.lang.*; class sum { public int a,b; public sum(int x,int y) { a=x; b=y; System.out.println("addition of a,b:"+(a+b)); } public void disply() { System.out.println("sum="+(a+b)); } } class sub extends sum { int p,q; public sub(int c,int d) { a=c; b=d; System.out.println("sub of c,d:"+(a-b)); } public void disply() { System.out.println("sub="+(a-b)); } } public class poly { public static void main(String args[]) { sum a=new sum(4,6); sub s=new sub(2,3); sum ref; ref=a; a.disply(); sub ref; ref=s; s.disply(); } }
    10 pointsBadges:
    report
  • Ramraviboddu
    In my login/logout application after log in succesfully... we enter in to user page that contain logout button like gmail.. and we have a anchor tag, if we click on that we move to another jsp page called details.jsp.... hear my doubt is i want to come back from details.jsp to user page.. after that.. in user page after we click on logout button i want disable the back button... i tried like in javascript i call window.history.forward() method... but wat happen is... the back button is disabled both times when i click on logout and click on anchoring tag... but i want only when i click on logout
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following