Java application compiles java files in memory
how can I use java application program (that may call method runtime exec or some other techniques) to compile the other java files that were already loaded in memory. (I can not copy those target files to the hard disk with extension java, then compile for security reason).
And once they are compiled, where do you plan to put the compiled .class files? Same security problem, right? Perhaps you planned to load and use them "from memory" somehow? This would be a different security problem. Perhaps you need to rethink what you are doing.
Similar Messages
-
Any idea how the java application can get the physical memory?
Hello, everyone
Any idea how the java application can get the physical memory?
thanks in advanceI believe what yo intend to do is forbidden, but here
my answer.
when you start your application you can give your VM
the entire memory of your pc. like this this memory
is completly under your control.* headdesk * -
Deploying no java applications using Java Web Start
Hi,
I am new to java web start. Is it possible to distribute non java applications using java web start. I have an APP which can run on a desktop in standalone mode. The app has jusy HTML and Java script files. Is it possible to package this app and deploying using java web start? I am assuming If it is possible, I can make updates to the packaged app in the web servers and the updates will be downloaded next time the app is used provided configurations are correct?
thxThe app has jusy HTML and Java script files. Is it possible
to package this app and deploying using java web start? Not really. Resources for JWS need to be zipped,
while this HTML/JS app. will (I guess) not work from
inside the depths of a Jar (or Zip) archive.
Note that you can organise for those files to be
downloaded and expanded onto a known place
on the user's disk, by using an 'installer' element,
but..
...I am assuming If it is possible, I can make updates to the
packaged app in the web servers and the updates ..installers are only called once, and do not 'update'. -
How to turn a Java Application an .exe file?
Hello, I'am just above new commer in Java world. I was wondering if anyone could help me. I just developed an application in java, how can I turn it into exe file? is there a way I can run this application without the "Command" promt (window) running?
Pls. help my email address is "[email protected]"
Any assistance will be largely appreciated.you can try the J++ compiler provided with the JBuilder from Microsoft but this is just compiling the java to C++. to create a standalone exe is as far as I know impossible. U can try to use a jar-archive (create with the sdk) and if a Java Virtual Machine is installed (normally with every popular web-browser) it will run with a doubleclick
-
Change java application to exe file
I want to change the java application(*.class)to the exe file in WIN OS in order to update its speed, can anyone tell me some useful infomation? thanx in advance.
HollyI have been using VAJ for several months now and I have not found the option to compile a native executable. Its help system is the worst I can recall ever seeing. So can you tell me exactly how to do that with VAJ?
-
Closing Console window while running Java application from Batch file
Hi all,
I have made a small application using Java swings,now i have made a jar file of my application and calling this jar file through batch file,when user clicks on that batch file it runs "java -jar applicationname.jar" command,but problem is that when i run that file from batch file it opens Dos console window at baclk of the screen which looks weird for a desktop application,i dnt want that Dos console window visible at the backend while my application is running,i have searched regarding this on google but found nothing usefull,if anybody can please help regarding that it will be a great releif for me,i have been stuck on this problem from last two days.
Thanks.
Simerwarnerja wrote:
georgemc wrote:
warnerja wrote:
start java -jar applicationname.jar
That'll pop up another consoleI'm under the impression that the console window he is seeing is the one which cmd.exe opens when it is executing the batch file. And that batch file won't return until the java process has completed because he didn't start it in the background to let the batch file continue and terminate.
So I don't think just simply substituting java with javaw will do much good either. Still think he needs a "start" command in that batch file.
So now he can try:
start java -jar ...
or
start javaw -jar ...Fair point -
Java application - build JAR file & include JCO library
Hello everyone,
I have a problem with my Java application that <i>connects to SAP system using JCO </i>library <b>(sapjco.jar)</b>.
I would like to create a JAR file from my Java application but when I run the JAR file that I created I get an error that <b>NoClassDefinitionFoundError com/sap/mw/jco/JCO at [...]</b>
That means that the JCO and associated DLL files <b>(sapjco.jar, librfc32.dll and sapjcorfc.dll)</b> were <u>not</u> included/packed in my JAR file.
<b>-- How can I include the JCO lib in JAR file?
-- If there is a problem with the DLL files, how can I include the JCO lib externally (dynamicly read the JCO whenever my JAR in run)?</b>
I am using Eclipse 3.2 and Export to JAR option when I click right button on Project.
THANKS IN ADVANCE FOR HELP!!!Hi,
The problem is that you don't have defined the libraries in the Manifest file of your jar-file. So the jar doesn't know what to use at runtime.
Add following entry to the MANIFEST.MF file:
Class-Path:/<lib_folder>/<lib1_name>.jar; /<lib_folder>/<lib2_name>.jar and so on.
Regards,
Daniel -
Java application export output file of Crystal Report in .TXT format
Hi,
I have a Java application which is able to export the output file of Crystal Report in PDF format. But I'm trying to change the export file to .TXT format. Is this possible? I'm using Crystal Report XI. Is there any available updates or fixes to solve this? Please advice.
Thank youI've tried, but I have an error
frm-40735: when button-pressed trigger raised unhandled exception ORA-06502
ORA-06502 when I try write a text field to the file the text field in question is a date.
Did a similar problem ever occured to you? -
Query regarding running Java application from Batch file
Hi,
I have written an application in Java and I have packaged it as a JAR file.
In my system I use a batch file called 'run.bat' to execute the program. The batch file is as follows:
java -classpath "%CLASSPATH%;editor.jar" editor.JPad
This works fine in my system. But when it is executed in other systems where JRE is not configured properly, I am not able to correctly start the Java application.
Please can anybody tell me, how to detect the JRE from the Batch file and refer to it correctly, so that it will run in any system with JRE.
Can we do this from a Batch file ?
Hoping for a quick reply.
Thanks,
S.SampathYou can't really "detect" whether a JRE is available from a batch. All I can think of is to check for the typical Java variables (JVM_HOME, CLASSPATH etc) to exist. If they don't, especially JVM_HOME, a JRE is probably not installed.
-
Java Application as jar File cannot connect to SAP via JCO
Hey guys,
I wrote a test class to play a little with the java connector. Everything worked fine.
Now I want to pack my java class and the JCO classes in one jar file. I have written a manifest file with the Main-Class statement and after I start the jar file I got following exception:
Exception in thread "main" java.lang.ExceptionInInitializerError: JCO.classIniti
alize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjco
rfc in java.library.path]. java.library.path [C:\WINDOWS\system32;.;C:\WINDOWS\S
ystem32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Ja
vaConnector\sapjco.jar;C:\j2sdk1.4.2_12\bin;]
at com.sap.mw.jco.JCO.<clinit>(JCO.java:776)
at de.lymez.sti.SAPAufruf.getDocnr(SAPAufruf.java:26)
at de.lymez.sti.Aufruf.main(Aufruf.java:12)
Can anyone help me? I don't think that I forget something during the JCO installation, because my class file worked fine and give me the correct values out of the SAP System.
Best regards,
TimoThanks Vladimir,
but I followed the Tutorial and copied every dll in the wright folder and set the pathes. In one of the threads someone told about a tool named dependency walker. I used this with the sapjcorfc.dll and the tool answered that the DRVADODB.DLL is not found. Can anyone send me this dll? And why worked everything fine, when I use the class? I only have problems when I use one jar file!
Thanks for any help!!
Regards,
Timo -
JVM Error while running java application through Java Webstart
Hi All,
While running java application through Webstart, we got the following error log and application is not running. I am not sure why this is happened? Can anyone help me out to resolve this problem?
Help Regarding this will be highly appreciated.
Thanks In advance.
Bala
Error in Log File:
# An unexpected error has been detected by HotSpot Virtual Machine:
# Internal Error (53545542324F5554494E45530E435050008C), pid=684, tid=9424
# Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)
--------------- T H R E A D ---------------
Current thread (0x00345a60): JavaThread [_thread_in_vm, id=9424]
Stack: [0x00030000,0x00070000), sp=0x0006f9a4, free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x12430d]
V [jvm.dll+0x6366e]
V [jvm.dll+0x636a3]
V [jvm.dll+0x10073c]
V [jvm.dll+0x7859b]
V [jvm.dll+0x919fc]
C [javaw.exe+0x2120]
C [javaw.exe+0x11bb]
C [javaw.exe+0x3151]
C [kernel32.dll+0x123e5]
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
Other Threads:
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 2304K, used 42K [0x02a60000, 0x02cd0000, 0x051c0000)
eden space 2112K, 2% used [0x02a60000, 0x02a6a908, 0x02c70000)
from space 192K, 0% used [0x02c70000, 0x02c70000, 0x02ca0000)
to space 192K, 0% used [0x02ca0000, 0x02ca0000, 0x02cd0000)
tenured generation total 30272K, used 0K [0x051c0000, 0x06f50000, 0x22a60000)
the space 30272K, 0% used [0x051c0000, 0x051c0000, 0x051c0200, 0x06f50000)
compacting perm gen total 8192K, used 409K [0x22a60000, 0x23260000, 0x26a60000)
the space 8192K, 4% used [0x22a60000, 0x22ac64d0, 0x22ac6600, 0x23260000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040d000 C:\Program Files\Java\jre1.5.0_11\bin\javaw.exe
0x7c800000 - 0x7c8c0000 C:\WINDOWS\system32\ntdll.dll
0x77e40000 - 0x77f42000 C:\WINDOWS\system32\kernel32.dll
0x77f50000 - 0x77fec000 C:\WINDOWS\system32\ADVAPI32.dll
0x77c50000 - 0x77cef000 C:\WINDOWS\system32\RPCRT4.dll
0x77380000 - 0x77412000 C:\WINDOWS\system32\USER32.dll
0x77c00000 - 0x77c48000 C:\WINDOWS\system32\GDI32.dll
0x77ba0000 - 0x77bfa000 C:\WINDOWS\system32\MSVCRT.dll
0x71c20000 - 0x71c32000 C:\WINDOWS\system32\tsappcmp.dll
0x76290000 - 0x762ad000 C:\WINDOWS\system32\IMM32.DLL
0x6d640000 - 0x6d7dd000 C:\Program Files\Java\jre1.5.0_11\bin\client\jvm.dll
0x76aa0000 - 0x76acd000 C:\WINDOWS\system32\WINMM.dll
0x71bc0000 - 0x71bc8000 C:\WINDOWS\system32\rdpsnd.dll
0x771f0000 - 0x77201000 C:\WINDOWS\system32\WINSTA.dll
0x71c40000 - 0x71c98000 C:\WINDOWS\system32\NETAPI32.dll
0x76b70000 - 0x76b7b000 C:\WINDOWS\system32\PSAPI.DLL
0x6d290000 - 0x6d298000 C:\Program Files\Java\jre1.5.0_11\bin\hpi.dll
0x6d610000 - 0x6d61c000 C:\Program Files\Java\jre1.5.0_11\bin\verify.dll
0x6d310000 - 0x6d32d000 C:\Program Files\Java\jre1.5.0_11\bin\java.dll
0x6d630000 - 0x6d63f000 C:\Program Files\Java\jre1.5.0_11\bin\zip.dll
VM Arguments:
jvm_args: -Xms32m -Xmx512m -Xbootclasspath/a:C:\Program Files\Java\jre1.5.0_11\lib\javaws.jar;C:\Program Files\Java\jre1.5.0_11\lib\deploy.jar -Djnlpx.home=C:\Program Files\Java\jre1.5.0_11\bin -Djnlpx.splashport=1970 -Djnlpx.jvm="C:\Program Files\Java\jre1.5.0_11\bin\javaw.exe" -Djnlpx.remove=true -Djava.security.policy=file:C:\Program Files\Java\jre1.5.0_11\lib\security\javaws.policy -DtrustProxy=true -Xverify:remote -Djnlpx.heapsize=32m,512m
java_command: com.sun.javaws.Main C:\DOCUME~1\ssiwach\LOCALS~1\Temp\1\javaws3
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=C:\Program Files\Java\jre1.5.0_11\bin;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\mysql\bin;"C:\Program Files\Java\jre1.5.0_11\bin"
USERNAME=ssiwach
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 1, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows Server 2003 family Build 3790 Service Pack 1
CPU:total 2 (cores per cpu 1, threads per core 2) family 15 model 4 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ht
Memory: 4k page, physical 2097151k(438060k free), swap 4194303k(5136k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_11-b03) for windows-x86, built on Dec 15 2006 01:16:12 by "java_re" with MS VC++ 6.0
------------------------------------------------------------------------------------------------------------------Hi All,
While running java application through Webstart, we got the following error log and application is not running. I am not sure why this is happened? Can anyone help me out to resolve this problem?
Help Regarding this will be highly appreciated.
Thanks In advance.
Bala
Error in Log File:
# An unexpected error has been detected by HotSpot Virtual Machine:
# Internal Error (53545542324F5554494E45530E435050008C), pid=684, tid=9424
# Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)
--------------- T H R E A D ---------------
Current thread (0x00345a60): JavaThread [_thread_in_vm, id=9424]
Stack: [0x00030000,0x00070000), sp=0x0006f9a4, free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x12430d]
V [jvm.dll+0x6366e]
V [jvm.dll+0x636a3]
V [jvm.dll+0x10073c]
V [jvm.dll+0x7859b]
V [jvm.dll+0x919fc]
C [javaw.exe+0x2120]
C [javaw.exe+0x11bb]
C [javaw.exe+0x3151]
C [kernel32.dll+0x123e5]
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
Other Threads:
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 2304K, used 42K [0x02a60000, 0x02cd0000, 0x051c0000)
eden space 2112K, 2% used [0x02a60000, 0x02a6a908, 0x02c70000)
from space 192K, 0% used [0x02c70000, 0x02c70000, 0x02ca0000)
to space 192K, 0% used [0x02ca0000, 0x02ca0000, 0x02cd0000)
tenured generation total 30272K, used 0K [0x051c0000, 0x06f50000, 0x22a60000)
the space 30272K, 0% used [0x051c0000, 0x051c0000, 0x051c0200, 0x06f50000)
compacting perm gen total 8192K, used 409K [0x22a60000, 0x23260000, 0x26a60000)
the space 8192K, 4% used [0x22a60000, 0x22ac64d0, 0x22ac6600, 0x23260000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040d000 C:\Program Files\Java\jre1.5.0_11\bin\javaw.exe
0x7c800000 - 0x7c8c0000 C:\WINDOWS\system32\ntdll.dll
0x77e40000 - 0x77f42000 C:\WINDOWS\system32\kernel32.dll
0x77f50000 - 0x77fec000 C:\WINDOWS\system32\ADVAPI32.dll
0x77c50000 - 0x77cef000 C:\WINDOWS\system32\RPCRT4.dll
0x77380000 - 0x77412000 C:\WINDOWS\system32\USER32.dll
0x77c00000 - 0x77c48000 C:\WINDOWS\system32\GDI32.dll
0x77ba0000 - 0x77bfa000 C:\WINDOWS\system32\MSVCRT.dll
0x71c20000 - 0x71c32000 C:\WINDOWS\system32\tsappcmp.dll
0x76290000 - 0x762ad000 C:\WINDOWS\system32\IMM32.DLL
0x6d640000 - 0x6d7dd000 C:\Program Files\Java\jre1.5.0_11\bin\client\jvm.dll
0x76aa0000 - 0x76acd000 C:\WINDOWS\system32\WINMM.dll
0x71bc0000 - 0x71bc8000 C:\WINDOWS\system32\rdpsnd.dll
0x771f0000 - 0x77201000 C:\WINDOWS\system32\WINSTA.dll
0x71c40000 - 0x71c98000 C:\WINDOWS\system32\NETAPI32.dll
0x76b70000 - 0x76b7b000 C:\WINDOWS\system32\PSAPI.DLL
0x6d290000 - 0x6d298000 C:\Program Files\Java\jre1.5.0_11\bin\hpi.dll
0x6d610000 - 0x6d61c000 C:\Program Files\Java\jre1.5.0_11\bin\verify.dll
0x6d310000 - 0x6d32d000 C:\Program Files\Java\jre1.5.0_11\bin\java.dll
0x6d630000 - 0x6d63f000 C:\Program Files\Java\jre1.5.0_11\bin\zip.dll
VM Arguments:
jvm_args: -Xms32m -Xmx512m -Xbootclasspath/a:C:\Program Files\Java\jre1.5.0_11\lib\javaws.jar;C:\Program Files\Java\jre1.5.0_11\lib\deploy.jar -Djnlpx.home=C:\Program Files\Java\jre1.5.0_11\bin -Djnlpx.splashport=1970 -Djnlpx.jvm="C:\Program Files\Java\jre1.5.0_11\bin\javaw.exe" -Djnlpx.remove=true -Djava.security.policy=file:C:\Program Files\Java\jre1.5.0_11\lib\security\javaws.policy -DtrustProxy=true -Xverify:remote -Djnlpx.heapsize=32m,512m
java_command: com.sun.javaws.Main C:\DOCUME~1\ssiwach\LOCALS~1\Temp\1\javaws3
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=C:\Program Files\Java\jre1.5.0_11\bin;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\mysql\bin;"C:\Program Files\Java\jre1.5.0_11\bin"
USERNAME=ssiwach
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 1, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows Server 2003 family Build 3790 Service Pack 1
CPU:total 2 (cores per cpu 1, threads per core 2) family 15 model 4 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ht
Memory: 4k page, physical 2097151k(438060k free), swap 4194303k(5136k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_11-b03) for windows-x86, built on Dec 15 2006 01:16:12 by "java_re" with MS VC++ 6.0
------------------------------------------------------------------------------------------------------------------ -
Start java application from java program
My problem is the following:
I start a java application A that allows you to select a couple of .java files.
After having choosen them, the application adds some additional information to these .java files (that means some more lines of code � we call it �infecting� the java files).
After the files have been infected, I want to start the application B implemented by these choosen and infected .java-files (without a new start of the Java Virtual Machine)
For doing so, we use the following method whichs works quite fine:
public static void ExecuteWithInvoke(String path, String classname)
try
new URLClassLoader(new URL[] {new File(path).toURL()})
.loadClass(classname).getMethod("main",
new Class[] { String[].class }).invoke(null,
new Object[] { new String[] {} });
catch (Exception e)
{e.printStackTrace();}
The only problem that occurs:
When the application B is launched, the �old� version of the choosen .java files is used and not the current, already infected version of these files. (I guess because the �old� .class files are used.)
I solved this problem by finishing the program A after the infecting and restart my application B manually. In this case the infected .java files are used (I guess the new Start of the Java Virtual Machine solves my problem by reloading the �new� .class files)
How can I reach to start my application with the mentioned method but with the infected .java files and without having a new start of the JVM ??
Can anybody help me?
Thanks in advance
Sorry for my English, it�s a long time since I quit schoolHello,
my problem of reloading classes is still unsolved although you tried to help me!
Therefore I posted a little program to illustrate our difficulty.
It would be nice if somebody could have a look at this program.
We have a file Testdatei.java whose only method is the main method.
I get the class object of this file and with the help of Reflection the declared methods.
Evereything works fine so far.
Then I change the content of this file by adding an additional method a() (see change() for this).
Now I delete the old class file and I compile Testdatei.java again (see compileJava()) and once more I get the class object for this changed file. Afterwards I get the declared methods for this class via reflection.
But instead of showing now the methods main() and a() Reflection still only shows the method main().
I guess the changed class has not been reloaded!!
package testpackage;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import com.sun.tools.javac.Main;
public class LoadClass
private File f;
private Class c = null;
private Object o;
public LoadClass()
f = new File("C:/AAJ/src/testpackage/Testdatei.java");
try
o = neuesExemplar(f.getPath(), "testpackage.Testdatei");
c = o.getClass();
System.out.println("Class " + c.getName() + " found.");
catch (Exception e)
{e.printStackTrace();}
Method [] method = c.getDeclaredMethods();
for (int i=0; i<method.length; i++)
System.out.println(method.getName());
change();
compileJava(f.getPath());
File fileToDelete = new File("bin/testpackage/Testdatei.class");
System.out.println(fileToDelete.delete());
Class cla = null;
try
Object o = neuesExemplar(f.getPath(), "testpackage.Testdatei");
cla = o.getClass();
System.out.println("Class " + cla.getName() + " found.");
catch (Exception e)
{e.printStackTrace();}
Method [] methods = cla.getDeclaredMethods();
for (int i=0; i<methods.length; i++)
System.out.println(methods[i].getName());
private int compileJava(String javaFile)
String[] args = {"-d", "C:/AAJ/bin/", "-classpath", System.getProperty("java.class.path"), javaFile};
return Main.compile(args);
public static void main(String[] args)
new LoadClass();
private Object neuesExemplar(String pfad, String klassename) throws Exception
URL url = new File(pfad).toURL();
URLClassLoader cl = new URLClassLoader( new URL[]{ url });
Class c = cl.loadClass(klassename);
return c.newInstance();
private void change()
FileWriter fw;
BufferedWriter bw;
try
fw = new FileWriter(f);
bw = new BufferedWriter(fw);
bw.write("package testpackage;");
bw.newLine();
bw.newLine();
bw.write("public class Testdatei");
bw.newLine();
bw.write("{");
bw.newLine();
bw.write("public static void main (String [] args)");
bw.newLine();
bw.write("{");
bw.write("System.out.println(4);");
bw.newLine();
bw.write("}");
bw.newLine();
bw.newLine();
bw.write("private void a ()");
bw.newLine();
bw.write("{");
bw.newLine();
bw.write("System.out.println(55);");
bw.newLine();
bw.write("}");
bw.newLine();
bw.write("}");
bw.close();
fw.close();
catch (IOException e)
{e.printStackTrace();}
I�m using eclipse 3.1.0. Is it possible that it�s a bug in eclipse that eclipse holds the old class file in memory from the beginning and always refers to this one and not to the new compiled one?
Thanks a lot
Simon -
How can i built a java application using java debug class on Log4J
Hi,
As java API support the MethodEntryEvent, using which I can get the automatic logging statements when the method is entered or exited as HelloExample.main(with argument type).
Where HelloExample is the class name.
Main is the method entered with its argument types.
In some cases I have the o/p as
-- VM Started --
====== main ======
main -- HelloExample
callerMethod -- HelloExample
====== main end ======
-- The application exited --
By using Log4J is there any possibility of getting these sort of o/p along with the loggers supported by Log4J. i mean to say can i built an java application which supports the MethodEntryEvent and MethodExitEvent from java API and also uses the Log4J debugging. I took an e.g. trace example, which (in J2SE 1.4.x or 5.x) will be found in $JAVA_HOME/demo/jpda/examples.jar and unpacking it by
jar -xvf $JAVA_HOME/demo/jpda/examples.jar i found the com/sun/tools/example/trace/Trace.java and passed the class constructed with logger taken from Log4J. In this case the logging message is displayed on the console. As per the requirement i need to transfer the whole o/p to an output file along with Log4J logger statements. in this case i should not give any command in the cosule except compiling and executing the programme. the programm also should able to run without the main() as i need to integrate Log4J with an application and the code must me application server independent. i need the output as i got using MethodEnteryEvent (shown as above) in case of java application built using Log4J.
Can any one help me in this regard. can any one give me some suggestion or any programme of this sort. All suggestions are welcomed.
Thanks & Regards,hi,
can someone help me how to implement logging for method entry parameters and
method exit return value.
can someone help me how to use log4j and integrate it to the method entry
logging and method exit logging.
Here what i need is without writing the log statements for the method entry and
method exit i need to log it to the file
along with other log4j debug statements i provide in the file.I should be able
to configure whether to enable/disable the logging
for method entry and method exit. In method entry i should be able to log the
parameters the method take and in method exit
i should be able to log te return value to the log file, before the method is
returned to the callee.
i hope i am clear
Thanks in advance. -
A question about design of Java Application on java card.
Hi every one,
I have a question about design of Java applet on java card,
There is an application on my card that it is not java card, it include a DF and some EF under DF, I would like to know if I want to have this application on java card ,how can I design DF and EF on java card ,I mean is there any relation between DF,EF with applet and file? for example can I say DF is same as applet and EF is same as file?
I'll appreciate for any help .
yours sincerely,
orchidhi
you can write a java class for DF.
an instance of DF class have some EF objects.
for example,
samples/com/sun/javacard/samples/JavaPurse/CyclicFile.java
implements ISO 7816 CyclicFile ( EF )
see also:
http://forum.java.sun.com/thread.jspa?threadID=673745&messageID=3936272
best regards,
siavash -
Disk Space "leaking" in Java Application Using java.io.RandomAccessFile
I have noted this behaviour in both java version 1.2.1 and 1.3.1 on Solaris 5.8.
I have a java application that is essentially "tailing" a very large log file.
The program opens a RandomAccessFile in read-only mode and calls readLine on the file as long as the file is getting written to.
If the file stops getting updated the program assumes the logfile has been moved/rotated/wrapped (by an external process) and the program the calls close and then reopens the file to allow the program to start reading from the new file and to allow the O/S to free up the system resources.
It appears that the program is not actually closing the filehandle or releasing the disk space and eventually the disk fills up.
When this happens the program is stopped and restarted and the disk space is freed up.
We have run the pfiles command against the running process and have confirmed that the old filehandles are still open.
I have attached what I think to be the relevant code lines below:
RandomAccessFile filehandle = null;
boolean reopen = true;
boolean connected = true;
while(connected)
if (reopen)
while(! new File(filename).exists())
doSleep (filewaittime);
filehandle = new RandomAccessFile(filename, "r");
while (file_being_updated)
// read from the file etc.
filehandle.close();
filehandle = null;
reopen = true;
The reopen flag is set to false in code not shown here.
I have verified that the block of code that calls close() on the filehandle and sets it to null is being executed when the logfile is moved externally.Hmmmm. Sounds like a hint to me :)
I am still experimenting but I will certainly try moving to the latest JDK and report a bug if I don't figure this out on my own.
Thanks.
Maybe you are looking for
-
Why isn't there an easy way to add a photo to photoStream from the finder?
Apple makes it easy to share your photo with Twitter, FB, Flickr, etc. Why not Photo Stream? As far as I know, the only way to add a photo to photo stream is to open iPhoto and then add the photo to that. This seems to be a very poor way of quickly
-
Dear Expert, how we can handle TDS deduction at the time of payment.
-
Hi All I need help, Itunes wont let me sync to the new music library i re-ripped onto my new re built comp without losing the songs I already had on my ipod. There are a lot of songs I bought off itunes that are not there anymore in my new library, H
-
What is the current Version of Oracle XML Publisher
Hi, This is S.V.Ramana Rao from india pls let me know following Details please, presently iam using XML Publisher Release 5.6.2, this is the current verions?. if it is a free version. where should i contact full version. for further details in india
-
How can i add new contacts to the adress book? iOS5
i've just upgrade to iOS 5 and i notice that i can't add new contacts to my adress book beacuse there is no + button