How to compile a java source from a java program

Hi .
I would like to know how to compile my java source from inside an execution of a java program.
Is there another way than rather use :
Runtime.getRuntime().exec("javac myFile"); ?

you can and cann't use the source code of javac... or maybe use jikes...

Similar Messages

  • How to compile multiple java programs.

    Hi,
    I have different java classes located in a hierarchy of folders, how can I complile all of them in a batch and place all class files in a specified folder ?

    You can specify more than one file "javac file1.java file2.java" and use the file wildcard. "javac directory1\*.java directory2\*.java"
    Keep in mind that javac will use the Classpath to find classes.

  • Compiling one java program by another

    hi ppl
    how to compile a java program by another java program by using javac command.
    that is prog A must compile prog B using " javac B.java" command

    Try com.sun.tools.javac.Main.
    You require JDK_HOME/lib/tools.jar in CLASSPATH.

  • How to compile a java file in J9 for windows mobile 5.0

    I have downloaded J9 for windows mobile 5.0 and need help on how to compile a java file.

    You can compile your source code using J2SE ;)
    may be this is important for you:
    http://awareness.ics.uci.edu/~rsilvafi/pocketPC/index.
    html
    Regards!!!Actually i am using some eSWT related classes also.. so is there any way to compile from the J9 environment using J9 console..

  • How to compile Oracle Linux source?

    I accidentally downloaded source DVD "Oracle Linux Release 5 Update 2 source - DVD" instead of installable ISO image. Is there anyway I can compile it to make bootable ISO image?
    I tried to search this forum as well as other places but couldn't find any information hence thought of opening a thread before I proceed to download correct file which will again take 10+ hrs with my Internet speed :(
    Any help is highly appreciated. Also I need to know which packages are required to be installed for compiling the source if at all that is possible. I am using Ubuntu 11.10 Desktop.
    Thanks in advance for any help and hope to get a reply soon :) I need to urgently install Oracle 11gR2 on it.
    Edited by: user6582219 on Apr 12, 2012 1:10 AM
    While browsing the forum for any possible solution I came to a thread that discuss installation of a package oracle-rdbms-server-11gR2-preinstall. When searched through search engine I came to know about recent certification Oracle 11gR2 on Oracle Linux 6, here is the link https://blogs.oracle.com/linux/entry/announcing_oracle_database_11g_r2
    https://blogs.oracle.com/linux/entry/announcing_oracle_database_11g_r2
    Thing is I already have Oracle Linux 6 Update 2 (the latest) installed on my machine in dual boot mode so I dropped the idea of installing version 5.2. As per the documentation 11gR2 was not certified earlier on Linux 6.2 so I thought of installing 5.2 but it is not necessary now.
    I would still appreciate if someone could answer my question just for knowing the procedure compiling source. May be it can help someone else trying to achieve this.
    I have another couple of important questions and need guidance from the experts over here. I am not sure if it is appropriate to open a new thread but for now I am posting them here.
    Before proceeding here are my environment details:
    Machine: x86 32 bit with 2 GB RAM/250 GB HD.
    OS: Kubuntu 11.10 Desktop and Oracle Linux 6 Update 2 in dual boot mode.
    Here are my partition details for your reference but as I am planning to do the installation from the scratch following new ideal scheme you can jump to last paragraph following the line "*********************************" for my questions.
    Unfortunately my partition plan went wrong and here is what I have now:
    Disk /dev/sda: 250.1 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x3d5ba9e1
    Device Boot Start End Blocks Id System
    /dev/sda1 * 2048 1002047 500000 83 Linux
    /dev/sda2 151525080 361253654 104864287+ 7 HPFS/NTFS/exFAT
    /dev/sda4 1003518 151001087 74998785 5 Extended
    /dev/sda5 1003520 7002111 2999296 82 Linux swap / Solaris
    /dev/sda6 7004160 11001855 1998848 83 Linux
    /dev/sda7 11003904 51001343 19998720 83 Linux
    /dev/sda8 51003392 110041087 29518848 83 Linux
    Partition table entries are not in disk order
    /dev/sda1 here is /tmp, /dev/sda2 is my data partition, I have separate /home / (root) partition for Kubuntu and remianing around 20 GB in extended partition is used for Oracle Linux 6.2 with default Oracle suggested LVM partition. I also have separate /boot for Kubuntu and I chose not to install grub while installing Oracle Linux. I later modified grub.cfg to add entries for Oracle Linux and now I can boot both OSs successfully.
    My issue now is I cannot extend 20 GB space (in extended partition) that I have given to Oracle though I have around 40 GB space available. This is because I alreay have 4 primary partitions (one for /boot others for "data" and one extended partition). So I have to make primary partition out of free space and install Oracle in a single partition without following recommended partition layout scheme.
    Now I want to do the installation of both the OS from the scratch and really need an advice on partition layout scheme. Here is summary of what I wan to achieve:
    1. Keep the "data" partition (primary) intact and carve an ideal partition layout for both the OS with separate /boot, /tmp, /home, swap (and may be for /usr???). Also may be I can share swap?
    2. How do I go about using LVM and is it recommended for this case? What would be ideal locations for each partitions and sizes? I already used 100 GB for "data" so now I want to keep 60 GB for Oracle Linux (and Oracle DB for which I will again make few sub-partitions) and remaining will be for Kubuntu.
    Well, I am not sure if this is the right place to ask these questions but since I can see very knowlegeable top contributors here that are willing to help novice users I thought of posting these questions.
    I would really really appreciate if someone can provide me rough draft of partition scheme in my case considering the sub-partitions needed for Oracle DB. I went thorugh number of forums and documentations to come up with solutuion and finally thought of getting help after much confusion.
    I really need to carefully plan this time because it's third time I am doing reinstallation from the scratch because of poor plan I followed previously.
    Thank you very much in advance and please let me know in case more information is needed from my side.
    Regards,
    Ramesh

    I accidentally downloaded source DVD "Oracle Linux Release 5 Update 2 source - DVD" instead of installable ISO image. Is there anyway I can compile it to make bootable ISO image?Google will be your best friend for such a question, for instance, "Creating a Custom centos Linux bootable ISO Image". There is no need to duplicate the effort. I recommend you download the correct installation DVD, e.g. 5.8
    Thing is I already have Oracle Linux 6 Update 2 (the latest) installed on my machine in dual boot mode so I dropped the idea of installing version 5.2. As per the documentation 11gR2 was not certified earlier on Linux 6.2 so I thought of installing 5.2 but it is not necessary now.So you don't need to install 5.2 anymore, but you want the information how to compile a installation DVD from the 5.2 source anyway?!
    I have another couple of important questions and need guidance from the experts over here. I am not sure if it is appropriate to open a new thread but for now I am posting them here.Questions may be important for you, but not necessarily for others. No one will complain if you create a new thread for particular questions or subjects. It is better to separate your topics and questions rather than creating a multi-mega thread, which does little to help anyone else but you. It means more work on your end, but it will be easier for anyone to participate or answer your questions, and it will allow you to better award answers.
    Regarding your partitioning questions: It is generally difficult to address such topics in a forum. You are asking for a book of information. My advice is to drop the old fashioned concepts of dual or triple boot options and install Oracle VirtualBox instead. It will make all of these questions obsolete and you can use whatever defaults when installing your virtual machine guest OS. Its a far more superior way of dealing with multiple operating systems on one and the same computer.
    I am using Ubuntu 11.10 Desktop.
    I need to urgently install Oracle 11gR2 on it.For what it's worth, if you can combine the two source below you should be able to install and run 11gR2 on Ubuntu 11.10.
    Install Oracle 11gR2 on Ubuntu Linux 11.04 (64-bit) Howto
    Install Oracle 11gR2 on Ubuntu Linux 11.04 (64-bit) Howto
    Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto
    Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto
    However, check out VirtualBox.

  • How to compile a java file which is in memory?

    how to compile a java file which is in memory?
    such as:
    String s="class MyClass {....}";
    how to compile the string?
    thx

    come on ...That was a perfectly valid solution.
    Do you know how to call the sun.* compiler? If not then search the forums for it. If that interface still exists (which it might not in newer versions) you then will create a string stream from your class and pass it to that.

  • How to compile Oracle java strored procedure in Putty

    I have created a java strored procedure , which would be invoked by oracle function.
    This java stored procedure is get compiled via SQL plus. While compiling by the use of putty , it shows lots of compilation error .
    How to compile Oracle java strored procedure in Putty??

    You'll need to add the j2ee.jar to your classpath. Usually you'll have to add some jars from your app server to your classpath as well.
    For example (using weblogic):
    javac -classpath c:\java\j2ee\j2ee1.3.1\lib\j2ee.jar;c:\tools\appserver\weblogic\wl7.1\lib\weblogic.jar
    HelloServlet.java

  • How to compile a java file(Servlet) in J2EE v1.3.1

    This is my first time using J2EE instead of J2SE!!HOw to compile a java file in J2ee\bin because there is no javac in j2ee and when i compile in J2se i got
    G:\j2sdk1.4.1_01\bin>javac HelloServlet.java
    HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    This mean it doen;t support servlet in J2se!!so how can /what command to compile a servlet java file in j2ee.Thanks

    You'll need to add the j2ee.jar to your classpath. Usually you'll have to add some jars from your app server to your classpath as well.
    For example (using weblogic):
    javac -classpath c:\java\j2ee\j2ee1.3.1\lib\j2ee.jar;c:\tools\appserver\weblogic\wl7.1\lib\weblogic.jar
    HelloServlet.java

  • How to invoke a Java Program from Oracle 10g?(uRGENT)

    Hello.
    I've a query, that i have a program, that basically retreives the records from the
    oracle table and then parser this information and then insert the values in corresponding database base tables. I want that, whenever the new program is inserted, a Trigger should fire and pass the most recently entered record to the Parser Program, means
    1) Firing a Trigge
    2)Storing the most latest data and pass it to the Parser PROGRAM
    Can someone tell me how to do this? How to invoke a Java Program from within the database? Please if anyone has examples provide me. Its very urgent and tell me what is the basic mechanism.
    Thankyou.
    Ben

    With Java Stored Procedures Java may be caleed from a database.
    http://www.oracle.com/technology/tech/java/jsp/index.html

  • How to compile a Java file

    Hi All,
    I am extending a seeded CO and when I try to compile it in JDev , it asks for many class files the seeded CO imports.
    I have copied all those imported files to my local system and when I try to compile , it still throws an error that some class files used by the classes imported in seeded CO are missing. Now this goes on and on. ( Seems entire server needs to be on my local system).
    Now I decided to port the custom CO to server and compile it there. Even this seems to be a hard task for me as the javac command is not working on the server. It throws following exception
    Exception in thread "main" java.lang.ClassFormatError: com.sun.tools.javac.main. Main (erroneous method access flags)......................................
    Pls suggest how to compile a java file , as downloading entire server classes is a herculean task for me.
    Thanks,
    Srikanth

    Hi Avajain & D.Ram ,
    Thanks for the reply.
    I have downloaded around 70 dependent class files to local system. Now the CO is getting compiled correctly.
    I am extending a region level controller in Payroll page where in I have to default the salary to a predefined value.
    This field is having a VO attribute to it. Now can I go ahead and set a value to the MessageTextInput or should I extend the VO to replace the desired value in the place of already queried value.
    Thanks,
    Srikanth

  • How to use Sql data source from Essbase 9.3.1

    Hi All,
    How to use Sql data source from Essbase 9.3.1 for ASO cube.Are there any rules and limitations for that.
    Do we need to create any data source connection for this purpose. If there please let me know the dteps to create that connection.
    Regards

    Yes you need to create one DSN connection and you have to use DSN name and login details at the time of building/loading of the outline.
    Create DSN
    Goto Administrative tools -> DataSources (ODBC) and add the DSN name and specify the Server name of SQL and login details and database.
    goto data prep editor and click on File Menu and Click on Open SQL option Next window opens.
    There you have to enter the details of the DSN connection and SQL query to build/load.
    Thanks,
    Prathap

  • How to make a Java program that recognises a function of two variables...

    How to make a Java program that recognises a function of two variables to assign values to that?
    First I will give an example and then do the question.
    Ex1.
    We have any function, eg.y = x ^ 2 + 1 (read 'y' equals 'x' high to the square), a function of the second degree.
    To build the graph of this function attach values to 'x' to find the values of 'y'
    And thus mount the pair ordered (x, y) which represents a point on the Cartesian plane.
    Assigning values to 'x' 'we can build up a table that gives us the pairs ordered:
    We can use any numbers, but arfer interval [-3.3]
    X | y = x ^ 2 + 1
    -3 | Y = (-3) ^ 2 +1 = 10
    -2 | Y = (-2) ^ 2 +1 = 5
    -1 | Y = (-1) ^ 2 +1 = 2
    0 | y = (0) ^ 2 +1 = 1
    1 | y = (1) ^ 2 +1 = 2
    2 | y = (2) ^ 2 +1 = 5
    3 | y = (3) ^ 2 +1 = 10
    We then ordered the pairs:
    (-3.10), (-2.5); (-1.2), (0,1), (1,2), (2,5), (3,10)
    Tabem that can be represented by a table:
    X | y
    -3 | Y = 10
    -2 | Y = 5
    -1 | Y = 2
    0 | y = 1
    1 | y = 2
    2 | y = 5
    3 | y = 10
    Now I begin to explain my doubts.
    See this program:
    Ex2
    * To change this template, choose Tools | Templates
    * And open the template in the editor.
    Encontrando_o_valor_de_y package;
    * @ Author des Soldat Gottes
    Import javax.swing.JOptionPane;
    Public class (Main
    * @ Param args the command line arguments
    Public static void main (String [] args) (
    Int x, y;
    String x1;
    X1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',"); / / receives a value for the function y = x + 1
    X = Integer.parseInt (x1); / / tranforma String in int
    Y = x + 1; / / receives the value of 'x' and calculates' y '
    JOptionPane.showMessageDialog (null, "The value of 'y' is: \ t \ t" + y);
    / / Displays the value of 'y'
    System.exit (0);
    We see that the program receives above a value for 'x' and replaces the function contained in the program, y = x + 1, and so is the value of the variable 'y'.
    In: x1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',");
    The entry is a number and that number is assigned aa ja existing function in the (y = x + 1).
    The question is: would it be possible to come to a function?
    Ex: the program ask: DIGITE THE FUNCTION?
    The USUARIO DIGITARIA A FUNCTION ANY, TYPE: y = x ^ 2 +1
    The program would recognize the function and give numerical values to that function as Ex1, at the beginning of this text.
    And then to find the values of the x and y launch a table.
    It would be possible that?
    By invez of entering with a number so that the program sustitua a function ja existing as Ex2, seen above, entering with a function quaquer (type: y = x ^ 2 +1) for the program atribuisse values to that function and then create a table of values as Ex1.
    I hope it has been easier to understand my doubts now.
    Thank you for your attention!
    God bless!

    rafaelmenezes wrote:
    Thanks for the explanation, could understand what fly said.
    But as it applied to a program?
    How to create a program that recognizes that the entry coefficients?Are you asking about how to parse out the coefficients from the string "3x^4 + 4x^3 - 8x^2 + 5x^1 + 2x^0"? If you define the format to strictly follow that example, this should get you started:
    Strip out the spaces
    Split the String on "x^"
    That should give you [3, 4+4, 3-8, 2+5, 1+2, 0]
    Split each resulting String on "+ | -", preserving the operator as a token so you can apply the correct sign to the coeff.
    That should leave you with [3, 4, +, 4, 3, -, 8, 2, +, 5, 1, +, 2, 0]. Every other number is a coeff, the rest are the degrees.
    You can strip out the +, since those coeffs are already positive, and strip out the - after negating the following number. This is all assuming that you have to write this yourself. There is no doubt already a library or 5 out there that does this for you.

  • How to call a java program in javafx class(Urgent) and even vice versa

    Hi all,
    Here I have two questions:
    1)
    Please let me know how to call a javafx in java program...
    I tried with the following code but it is not working..
    The below is the java program in which I made a call to the Fx program.
    FxMainLauncher.java
    import net.java.javafx.FXShell;
    public class FxMainLauncher {
    public static void main(String[] args) throws Exception {
    FXShell.main(new String[] {"HelloWorld.fx"});
    2) How to call a java program in javafx class
    Here is my javafx program
    import check.*;
    import javafx.ui.*
    var instance = new MyJava();
    //visible:true
    System.out.println("Number is: {instance}");
    Here is my java program
    public class MyJava {
    public static void main(String args[])
    System.out.println("JAVAFX TO JAVA");
    Even this is not working please let me know ASAP
    Thanks in advance,
    V.Srilakshmi

    GOT IT !!!
    I had to change the name of the method in .h file generated by javah command. On doing
    javac -d ../../classes HelloWorld.java
    go to the ../../classes directory (where you have the class file) and do
    javah HelloWorld
    I got a HelloWorld.h file in which I had
    JNIEXPORT void JNICALL Java_HelloWorld_display(JNIEnv *, jobject);
    I added the package name too:
    JNIEXPORT void JNICALL Java_GUI_HelloWorld_display(JNIEnv *, jobject);
    The HelloWorldImp.c file should have the same name (ie with package) and be in the same directory(ie ../../classes)
    compile and build the shared library to get "libhello.so" file
    gcc -c -fPIC -I/usr/lib/j2sdk1.3/include -I/usr/lib/j2sdk1.3/include/linux HelloWorldImp.c
    gives .o file
    gcc -shared -o libhello.so HelloWorldImp.o
    gives .so file
    then run java with the command in my first message. It works.
    Thanks for the reply "thedracle".

  • How to execute a java program by clicking !?!?

    Just a click to execute a java program?!!
    Like the ".exe" in Windows or "x" permission in Unix ?!?!?!
    How can I do that?
    And how to set a java program file to display as a personal icon? (My Icon)
    :-)

    Well this is what I do in Windows (I use XP but it works in others):
    First you have to make sure all the class files are in the same folder (duh)
    Then you copy your java.exe from your jre folder into the folder with all your class files.
    Finally, you create a shortcut to java.exe and add your class name to the command line on the shortcut.
    Now all you have to do is double click on the shortcut and your program runs. Sure it's not that pretty but it works.

  • How to call a BW Query from an ABAP program?

    How to call a BW Query from an ABAP program?

    hi
    check this link
    /people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i
    /people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-ii
    /people/durairaj.athavanraja/blog/2005/12/05/execute-bw-query-using-abap-part-iii
    hope this helps
    cheers

Maybe you are looking for

  • No Sound OUtput Device

    Morning All, Happy New Year and all that. I have an imac G5 which is about a year old. For some time I had an optical device plugged in to the speakers, and everything was punchie keen. Now, however, I am using said device ofer an Airport Express, wh

  • Exporting images changing sizes

    Hi, I am exporting some artwork with is on an A4 sized canvas and when I place that image into pages its half sized. I have reopened the .png in illustrator and it shows the correct size. Does anyone know if this is a problem with Illustrator or if i

  • Billing document to customer email ID

    Hi, I want any billing document save then billing document should go to automatically the customer email ID. Already I have maintained the email ID into the customer master. is it possiable? If yes, how? Pl provide the solution for above requirement

  • I need the BEST configuration...PLEASE!!!

    ok I have ALL of my media on a External NAS...a Westen Digital My World II to be exact.  I access itunes from several computers.  my laptop, my wifes laptop, and a computer that stays on all the time just so that I can have itunes always up for the A

  • _optimizer_push_pred_cost_based

    Is this parameter is dynamic or static??? KK