Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!

Arjun K

Ranch Hand
+ Follow
since Mar 09, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arjun K

1) Hprof is one profiling tool that comes with JDK and it need a startup VM option during the application launch.
http://java.sun.com/developer/technicalArticles/Programming/HPROF.html

Specify format as 'b' binary and you can visualize with Heap Analysis Tool(HAT) --> https://hat.dev.java.net/
java -agentlib:format=b Application1
or java -XrunHprof:format=b Application1

2) Jconsole is also one more solution which helps to give you a picture of an appication objectheap/stack occupancy, CPU performance etc.
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

3) Last but not the least is the JFluid that comes with Netbeans IDE. Jfluid helps to connect to a running application and doesn't requires any VM option during the application startup.
http://profiler.netbeans.org/

Hope this Helps,
Arjun.
14 years ago
Girish,

If a process crashes then it retains a core file along with a hs_err_pid file.

Do U have a hs_err_pid file?

HTH,
Arjun.
14 years ago
Pete,

OOME during compile time comes only when JVM doesn't have enough Virtual Memory to do compilation.

Try increasing the heap and stack sizes with -J-Xms, -J-Xmx, -J-XX:NewSize,
-J-XX:MaxNewSize VM options.



HTH,
Arjun K.
14 years ago


Taken From : Zak Nixon
Is there anyway to "legally" change the Java classpath
during program execution? Or some way to tell the JDK classloader
where to look for user specified files ?


No you cannot change the classpath dynamically with System.setProperty("java.class.path",newClassPath).

The way to achieve the effect is to create a java.net.URLClassLoader with the extra paths that you want to be searched during runtime.

HTH,
Arjun K
14 years ago


Taken From : David Miranda
It works, but saves the .class file in the src directory instead of the build directory. (But thats a separate issue)



javac -d d:/projects/testproj/build testproject.java

This will save the class file in build directory.

Regards,
Arjun K.
14 years ago
Steve,

Try attaching hprof to the jgraph application. That might help you with some information to debug.

bash%> java -agentlib:hprof=heap=sites jGraph

See for more hprof command line options at:
http://java.sun.com/developer/technicalArticles/Programming/HPROF.html

Regards,
Arjun K.
14 years ago


Taken From: amit taneja
Q2. How can you minimize the need of garbage collection and make the memory use more effective?
A. weak object references.


Check this good link for java object references.
http://www.ociweb.com/jnb/archive/jnbJune2000.html


Taken From: amit taneja
Q3. What comes to mind when you hear about a young generation in Java?
A. Garbage collection.


The allocated objects are divided in generations according to their ages, and young generations are checked more often than the older ones. On young generation fill up the objects will be moved up to old generation and permanent generations.

Also you can decide on young generation partitions and sizes with
-XX:NewSize
-XX:MaxNewSize
-XX:NewRatio
-XX:SurvivorRatio

HTH,
Arjun.
14 years ago
If you are working on j2se 5.0 then you can use processbuilder to run a process.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html

14 years ago


Below link directs to javadoc tool.

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html

Arjun.
14 years ago


Taken from Henry Wong post:
Unfortunately, if you are looking for system data, it is not available directly from the JVM. If I remember correctly, you might be able to get free memory, but even that, I don't think is free memory at an OS level.



I assume that you are touching on the situation prior to J2SE 1.5

Yes the java.lang.management package is the answer, that has been introduced in Tiger.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/package-summary.html

Good starting point is to play with jConsole:

http://java.sun.com/j2se/1.5.0/docs/guide/management/

HTH,
Arjun K
14 years ago
JSF is better than apache Struts in Web tier frame works.

Look at these links for more:
http://websphere.sys-con.com/read/46516.htm
http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk8.html

Have a look at SUN presentations on JSF:
http://www.jsftutorials.net/jsf-reading-guide/jsf-seminar.html

Arjun.
14 years ago
Java interpreter creates byte code which need to be run independently on any platform; for that it requires a JVM. So JVM is another layer of abstraction from the aplication to the underlying hardware; which interprets to the machine readable form.

People say its not advisable to use Java in device drivers; but the bad design makes the applications to perform low rather than the Java language itself. With latest facts which says that Java is embedded in 450 million PDA devices; lang used in Mars Rover(communicaton from Mars to Earth), increasing gaming s/w's with Java. And the list will never end.

Arjun.
14 years ago
If you are using JDK1.5 which packages java.management packages and helps in getting the system info.

<code>
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import com.sun.management.*;

public class Info {


public static void main(String[] args) {


OperatingSystemMXBean osMBean =
(OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();

RuntimeMXBean runtimeMBean = ManagementFactory.getRuntimeMXBean();


System.out.println("Operating system:\t" + osMBean.getName());
System.out.println("Architecture:\t\t" + osMBean.getArch());
System.out.println("Number of processors:\t" + osMBean.getAvailableProcessors());
System.out.println("Process CPU time:\t" + osMBean.getProcessCpuTime() );
System.out.println("Total physical memory:\t" + osMBean.getTotalPhysicalMemorySize()/1024 +" kB");
System.out.println("Free physical memory:\t" + osMBean.getFreePhysicalMemorySize()/1024 +" kB" );
System.out.println("Comm. virtual memory:\t" + osMBean.getProcessCpuTime()/1024 +" kB" );

System.out.println("Total swap space:\t" + osMBean.getTotalSwapSpaceSize()/1024 +" kB" );
System.out.println("Free swap space:\t" + osMBean.getFreeSwapSpaceSize() /1024 +" kB" );

}

}

</code>

Hope this helps,
Arjun K
14 years ago
Sony,
First you should know to set path and class path. Check this link which helps to set path and class path.
http://www.cs.ucsb.edu/~teliot/Path_and_Classpath.htm
Anyway also try this: "set PATH=C:\Java\jdk1.5.0_03\bin;%PATH%"
HTH
Arjun
14 years ago


Hope this helps.

-Arjun.
14 years ago