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
Similar Messages
-
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?
thxcome 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 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.. -
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,
SrikanthHi 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 compile a java file Dynamically !!!!
Hi all
The problem is
I have a dynamically created java file ,and i want to compile that file dynamically itself. The file name is stored in a string,
I am using ECLIPSE editor..
How do i compile this java file (which is stored in a string) dynamically?
Pls help me, already wasted a lot of time,
Thanks in advanceIn every Tutorial regarding Dynamic Compilation,
It is told to import javax.tools.*..
But i cannot find this package
I am using jdk1.4, is this the reason?
Actually the following packages are needed fro this
import javax.tools.DiagnosticCollector;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
but i cant finad any..!!!
Please help me -
How to compile a java file in a java program
Hi,
I don't know to compile a java file in a java class.
Could somebody help me?
Thanks.if ur using windows...
goto ur directory and then type
javac FILENAME.java
and ur done! -
How to compile other java files and run them from my own programs?
I'm developing a unit testing tool for AspectJ, which can originally generate the stubs for aspect unit to be tested. All these stubs are java files. After generation of stubs, how can I program the code to compile this unit together with these stubs, i.e. how can I put the functionality of compilation and run, e.g. command "javac *.java" and "java *", into my own code.
Hope you can understand what I mean.
Thank you in advance.When I use Runtime.getRuntime().exec(command) for executing the AspectJ compile command "ajc", "IOException createProcess error=2" always occurs, while it is ok for Java comiple command "javac".
Why this happens when I use Runtime.getRuntime().exec("ajc Hello.java Test.aj")? Is it the reason that Runtime.exec(String) may not support any command in DOS?
(ajc is the compile command for the java file and aj file.)
Thank you in advance. -
HOW TO INSTALL JDK1.4 ON LINUX PALTFORM AND HOW TO COMPILE A JAVA FILE
SIR PLZ KINDLY TELL ME THE PROCDURE OF INSTALL JSDK1.4 ON LINUX .
1.I HAVE DOWNLOADED IT ONA I HAVE INSTALL IN
/usr/local
but
2: do nt know how set the CALSSPATH and JAVA_HOME(ENV VARIABLES)
3:HOW TO COMPILE AND RUN THE JAVA FILE(JSP)2.
export JAVA_HOME=/usr/local/jdk1.4.0
export CLASSPATH=.
(amending for your set up.)
Placing these in your /etc/profile file will make them run automatically on log in of a user.
3.
You need tomcat, probably, http://jakarta.apache.org.
Bhav -
How to compile this java files ?
I have two files Foo.java & Foo2.java in separate packages.
PLEASE let me know how to compile these files .
package XYZ;
public class Foo {
public static void main(String[] args) { }
package XYZ.ABCD;
class Foo2 extends Foo{
public static void main(String[] args) { }
}I'm getting .. following error.
XYZ\ABCD\Foo2.java:3: cannot find symbol
symbol: class Foo
class Foo2 extends Foo{
^
1 errorYou need an import statement in Foo2.java.
import XYZ.Foo;This should come before the package statement. -
How to compile a java file to class with class
There is a java file.
And i want to compile it with class, not javac command.
so i can catch the compile errors.
how to do it?
special thanks.http://java.sun.com/developer/JDCTechTips/2003/tt0722.html#2
-
How to compile ALL java files in OR UNDER a given directory?
G'Day Folkies,
At face value, TikeSwing looks like the money shot for enforcing MVC in my version of minesweeper http://forum.java.sun.com/thread.jspa?forumID=54&threadID=5248903
I'm attempting to build the "Hello World" example which comes with TikeSwing.
http://www.javaworld.com/javaworld/jw-06-2005/jw-0620-tikeswing.html
It compiles ok
C:\Java\lib\tikeswing-1.5\example\src\fi\mmm\hello>javac -d C:\Java\home\classes -cp C:\Java\lib\tikeswing-1.5\src;C:\Java\lib\tikes
wing-1.5\lib\commons-beanutils.jar;C:\Java\lib\tikeswing-1.5\lib\commons-lang-2.0.jar;C:\Java\lib\tikeswing-1.5\lib\commons-logging.
jar;C:\Java\lib\tikeswing-1.5\lib\log4j.jar;C:\Java\lib\tikeswing-1.5\example\src;. HelloApplication.java
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
But it doesn't run
I presume that javac isn't detecting all dependancies, presumably because Tike "decouples M from V from C" using reflections.
C:\Java\lib\tikeswing-1.5\example\src\fi\mmm\hello>java -cp C:\Java\home\classes;C:\Java\lib\tikeswing-1.5\lib\commons-beanutils.jar
;C:\Java\lib\tikeswing-1.5\lib\commons-lang-2.0.jar;C:\Java\lib\tikeswing-1.5\lib\commons-logging.jar;C:\Java\lib\tikeswing-1.5\lib\
log4j.jar;C:\Java\lib\tikeswing-1.5\example\src;C:\Java\lib\tikeswing-1.5\src;. fi.mmm.hello.HelloApplication
Exception in thread "main" java.lang.NoClassDefFoundError: fi/mmm/yhteinen/swing/core/component/YFrame
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at fi.mmm.hello.HelloController.<init>(HelloController.java:8)
at fi.mmm.hello.HelloApplication.main(HelloApplication.java:8)So, Please, is there a way of telling javac to just build *.java in or under C:\Java\lib\tikeswing-1.5\src\ ... regardless of dependencies?
Thanking You for any thoughts. Keith.FYI.... Here's the quick and dirty, slower than a wet week, ugly, but effective batch script
set TIKE=C:\Java\lib\tikeswing-1.5
set SRC=%TIKE%\src
set LIB=%TIKE%\lib
set CLASSPATH=%LIB%\commons-beanutils.jar;%LIB%\commons-lang-2.0.jar;%LIB%\commons-logging.jar;%LIB%\log4j.jar;.
FOR /R %SRC% %%f IN (*.java) DO javac -d C:\Java\home\classes -cp %CLASSPATH% %%f
@ECHO OFF
REM http://www.robvanderwoude.com/ntfor.html
REM Walks the directory tree rooted at [drive:]path, executing the FOR statement
REM in each directory of the tree. If no directory specification is specified
REM after /R then the current directory is assumed. If set is just a single
REM period (.) character then it will just enumerate the directory tree.I can't figure out how do the equivalent of javac `dir /s /b *.java` (ie: cmd doesn't seem to have a built-in facility for expanding the results of a command into the command line) which would be a lot quicker and cleaner.
Cheers all. Thanx for the help. I appreciate it. -
How to compile a java file with specified jdk version in a program???
hi,
if we want to compile a program in another program with a particular
jdk version as an option, how to do that,plz reply and with example.Hi,
To compile from a program, read this (I've never tried, but I think it
will work):
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Compiler.html
To get the jre version:
System.getProperty("java.version");
To get the vm version:
System.getProperty("java.vm.version");
Other properties at:
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/System.html
Hope it helps,
ANeto -
How to Generate a Java file for a JSP Page
Hi ,
I am using weblogic11 .
I am working on a JSP page which nearly consists of 4000 lines of code.
I need to debug the file , but weblogic server is not generating the java file for the JSP pages .
Please let me know how can i genertae Java file for the jsp pages ??JSPs are compiled into servlets automatically and those classes are stored in WEB-INF/classes folder. Servlet engine handles servlets.
-
Error when compiling the Java file
Hi I have created a jsp program that uses the java files. i have jboss installed. when i compile the java file it gives compilation error saying that javax.servlet.jsp.tagext.TagSupport not found.
Although when i installed the Tomcat seperately i did not get any compilation error. can anyone tell me how to get out of this problem when Tomcat is not installed seperately.
Thanks,
RakeshHi
I think these errors are due to incorrect classpath settings.While compiling HelloHome ..Helloremote must be in classpath.Also if u have packaged them u must be in the package root during compilation ie if uor remote & home interface is in a package called "ejbserver"
then while compiling u must be in the folder above ejbserver & compile command is
javac .\ejbserver\*.java
If uor home & remote interface is in different folder check wheather u have imported the remote interface inside home interface file. -
How to compile a single file in a project
I have placed my java connector file called "xxxTargetconnector .class" in the below mentioned path
D:\FSCM9DMO\webserv\FSCMDMO9\applications\peoplesoft\PSIGW\WEB-INF\classes\com\peoplesoft\pt\integrationgateway\targetconnector
I have converted the above class file in to a java file using a decompiler.Now i would like to recompile the java file to get the byte code.This class file imports many class files from jar files which is placed in the below mentioned path.
D:\FSCM9DMO\webserv\Cybersource.
Before compiling i set the path to include the jar files
for ex , set path = D:\FSCM9DMO\webserv\Cybersource
For compilation i went to the below path using command prompt and compiled the particular file.
D:\FSCM9DMO\webserv\FSCMDMO9\applications\peoplesoft\PSIGW\WEB-INF\classes\com\peoplesoft\pt\integrationgateway\targetconnector>javac xxxTargetConnector.java
Unfortunately i got around 99 errors saying
xxxTargetConnector.java:187: cannot find symbol
symbol : variable Logger
location: class com.peoplesoft.pt.integrationgateway.targetconnector.xxxTargetConnector
How to compile a single file in a project ?According to [http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html], "As a special convenience, a class path element containing a basename of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR. I have never tried using this feature.
So if all of your dependent classes are in in jar files that are in D:\FSCM9DMO\webserv\Cybersource, a command like the following should work.
javac -cp D:\FSCM9DMO\webserv\Cybersource\* xxxTargetConnector.java
Note that setting your operating system path variable has no impact on where Javac looks for dependent classes.
Maybe you are looking for
-
Mac wouldn't start, erased hard drive
Hey everybody, Long story short, I erased my hard drive, and I don't have any way of re-installing OS X. All of the files and stuff I care about are backed up, so I'm not worried about that, I just don't have an OS (or even a partition) on my MacBook
-
NCO3 Error: cannot find STRUCTURE specified by LEDID_IDOC_TYPE
Hi all, I am trying to get an IDoc defininition by IDOC_TYPE_COMPLETE_READ. When I create the function with: IRfcFunction rfcFunction = destination.Repository.CreateFunction("IDOC_TYPE_COMPLETE_READ"); there is an Exception thrown: SAP.Middleware.Con
-
IW38 printing several MO with only one shop paper choice
Dear Gurus, I would like to use the t-code IW38 to print several MO on same time however I would like also to select the shop paper just one time instead many time for each MO. If I deselect all document type on t-code OIDG the sap asking me for each
-
After completing a 15 slide project I published the project as a PDF. When I launch the PDF, all content or intactive buttons have an extream latency before completeing there function. Any ideas why or how to make the PDF run smoother?
-
Searching for content within a specified directory
I am trying to do a simple content search on a specified directory, but I do not get the results I expect. I have looked at the examples and based my code upon them. If anyone can spot what I am missing or have forgotten I would be very grateful. Tha