java

Zipping a directory to a remote location in Java

I'm trying to create a zip file from a directory in Java, then place that file on a remote server (a network share). I'm currently getting an error because the Java File object cannot reference a remote location and I'm not really sure where to go from there. Is there a way to zip a directory in Java to a remote location without using ...

hprof file format

Does anyone know a reference for the .hprof (binary heap dumps) file format? Does anyone know libraries that handle .hprof files? I know that hat does that and also VisualVM through a NetBeans plugin. But are there others? ...

What is the best windows equivalent for /tmp ?

I want to improve the cross platform behavior of a java application. However, its test suite currently assumes the existence of the /tmp directory. What is the best equivalent location on the windows platform? N.B. I most definitely do not want to assume the user has admin rights but I do want it to work on at least XP, Vista & Windows7...

Java ANSI X923 Padding

I have a new application written in java that needs to read encrypted values out of a db. The problem is that all the values in the db were encrypted by .NET code that uses the ANSI x923 padding scheme. I have done some research and it doesn't look like the Java TripleDes libraries have a way to specify this padding scheme. I was wond...

GWT Relative Width

I'm trying to make a scroll panel that has relative size parameters. But the ScrollPanel.setSize(String, String) is impossible to work with if you have int values such as those returned by Window.getHeight, etc. Also when I do something like ScrollPanel.setSize("100%", "150px"); it doesn't change the ...

How to prevent an object from getting garbage collected ?

Please help me How to prevent an object from getting garbage collected is there any approaches by finalize or phantom reference and is there any other approaches? UPDATED:I was asked a ques in an interview he was referring something can be done in finalize() ...

JBoss: WAR file in EAR can't find JAR library on classpath

Hey Guys, I am having a problem deploying an ear with bundled wars, jars, and configuration files (.properties files) on JBoss 4.3-eap. Here is my ear structure: +app.ear +lib *.jar libraries that the war's use +classes *.properties and other configuration files +META-INF application.xml jbos-a...

Java name parse library?

I'm searching for a library similar in functionality to the Perl Lingua::EN::NameParse module. Essentially, I'd like to parse strings like 'Mr. Bob R. Smith' into prefix, first name, last name, and name suffix components. Google hasn't been much help in finding something like this and I'd prefer not to roll my own if possible. Anyone k...

What is the equivalent of Java's default (package) access in C#?

What is the equivalent of Java's default (package) access in C#? Is there one? Is there anyway to restrict access to a particular namespace? The Problem: I'm trying to restrict access to certain methods to just my NUnit tests - in JUnit I would do this by making the methods package access and having the test in the same package but un...

Use https only for certain pages in tomcat webapp

Hello, I have a struts2 webapp running under tomcat6 app server. The mode is https. The entire site is currently being served on https. But what I would really like to do is setup https only for certain operations like purchase and login. Is there any configuration in tomcat that can help me do this easily? Are there any code changes r...

What is the "persistence domain model"

I see a lot of references to this in Java software discussions specifically those talking about Hibernate. I cannot find any definition of what it is and why I care about it. Any one got a good definition for it? ...

how to make a separated copy of an ArrayList

Possible Duplicate: Java: how to clone ArrayList but also clone its items? I have a sample program like the following: ArrayList orginalInvoice = new ArrayList(); //add some items into it here ArrayList copiedInvoice = new ArrayList(); copiedInvoice.addAll(orginalInvoice); I thought I can modify items inside the copiedInvoi...

Invoke a GWT RPC service from Java directly

Is there an easy way to invoke a GWT RPC service endpoint directly from Java code? I mean real Java code, not Java code compiled down into javascript. I ask because we want to run performance benchmarks/stress tests against a GWT RPC interface. I would like to write the test harness in Java and run it in a JVM (as opposed to javascrip...

Find the value of a specific attribute in an XML file in java

I need to just read the value of a single attribute inside an XML file using java. The XML would look something like this: <behavior name="Fred" version="2.0" ....> and I just need to read out the version. Can someone point in the direction of a resource that would show me how to do this? ...

BeanUtils with Maps

How can I use the BeanUtils setProperty method with Maps. For example, this method: public void setAddress(String type, Address address); Can be setted using: BeanUtils.setProperty(beanObject, "address(home)", addressObject ); But if the object I want to set is a Map, is it possible? how? ...

How to automatically run JBoss app on startup, using RedHat

Not too long ago, I installed a java web application on a Red Hat server running JBOSS. After a recent reboot, I realized that the site did not start up automatically when the machine was booted. Is there an easy way to ensure that this happens? There are shell scripts to start and stop the application, something like : /opt/myApp/St...

regex: alternating character / sequential numeric

I am looking for regular expression in java that matches the following pattern: two alternating numeric or alpha values Example: 12121212 or adadadad numeric or alpha sequences with at least 4 sequential digits Example: cdefgh or 123456 thanks ...

Is there a Java JSON library that uses the same pattern as XMLEncoder

I have looked at a few JSON libraries for Java, but few of them seem to follow the same serialization pattern as core Java serialization patterns. I would like to use a native Java JSON serialization object, but in the absence of that what third party library matches Native serialization and preferably will serialize anything marked ser...

Adjust volume and prevent computer from standby in Java... (Mac and Windows XP, Vista)

I am writing a Java program that wants to do 3 things, and I don't know how to do them or if it's even possible with Java. 1 - I want to ensure that the computer whether running mac OS or windows xp/vista, doesn't go to sleep whilst running my app. 2 - I want my app to be able to turn the volume to full on all of the above OS's before ...

How to rotate an object in Java 3D?

I have a Cone I drew in Java 3D with the following code: Cone cone = new Cone(2f, 3f); Transform3D t3d = new Transform3D(); TransformGroup coneTransform = new TransformGroup(t3d); coneTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); t3d.setTranslation(new Vector3f(0f,0f,0f); coneTransform.setTransform(t3d); coneTransform...