java

How to convert List<Integer> to int[] in Java?

This is similar to this question: http://stackoverflow.com/questions/880581/java-convert-int-to-integer I'm new to Java. How can i convert a List to int[] in Java? I'm confused because List.toArray() actually returns an Object[], which can be cast to nether Integer[] or int[]. Right now I'm using a loop to do so: int[] toIntArray(List...

copy or move a file from one ftp server to another

I have a java application, which copies or moves a bunch of giga files from one ftp server to another. Currently it copies a file from the first fpt server to the local computer (where it runs) using ftp get and then copies it to the second ftp server using ftp put. I use net library from apache. Is it possible to copy it directly from...

Edit an image in java

hello, I have an image a map, The image must be contained in a JFrame and asked whether there are any java method that given coordinates (x, y) must make a kind of water mark or repaint the picture only in the specified coordinate anyone knows how to do or any idea how it would try to do ?? ...

adding jars to your program

i have a simple Demo.java file in D:\jarConcepts directory: import javax.swing.* ; class Demo{ public static void main(String args[]){ JFrame frame = new JFrame("") ; frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) ; Class c = null ; try{ c = Class.forName("com.mysql.jdbc.Driver") ; //com.m...

How to convert from File to IFile in java, for files outside the project?

Normall, this code is used for converting from File to Ifile: IWorkspace workspace= ResourcesPlugin.getWorkspace(); IPath location= Path.fromOSString(file.getAbsolutePath()); IFile ifile= workspace.getRoot().getFilesForLocation(location); But this only works for java files within the project. How can I get the IFile when File file i...

HashMap(key: String, value: ArrayList) returns an Object instead of ArrayList?

I'm storing data in a HashMap with (key: String, value: ArrayList). The part I'm having trouble with declares a new ArrayList "current," searches the HashMap for the String "dictCode," and if found sets current as the returned value ArrayList. ArrayList current = new ArrayList(); if(dictMap.containsKey(dictCode)) { current = d...

Mapping an Oracle Date to a Java object using Hibernate

I get the message "literal does not match format string". For instance, here are some methods from a Java class: public String getDateTime(); public void setDateTime(String date_time); Here is the mapping from the Hibernate config file for that class: <property name="dateTime" column="date_time"> and here is the DDL for that col...

Is there documentation available for Thinlet 0.75?

I've recently downloaded Thinlet 0.75 (http://www.thinlet.com/index.html) and was wondering if anyone knew of decent documentation for this framework? The tutorials/examples I have found online seem to refer to an older version of Thinlet as the code/xml is no longer applicable. The only semblance of documentation within the zip file...

sql server query running slow from java

I have a java program that runs a bunch of queries against an sql server database. The first of these, which queries against a view returns about 750k records. I can run the query via sql server management studio, and I get results in about 30 seconds. however, I kicked off the program to run last night. when I checked on it this mor...

Cannot redirect with the response.sendRedirect

Hello everybody, I gooogled and googled for hours on how to make a redirect in jsp or servlets. However when i try to apply it, it doesn't work. Code that i have inside jsp page: <% String articleId = request.getParameter("article_id").toString(); if(!articleId.matches("^[0-9]+$")) { response.sendRedirect("index.js...

Does anybody have any information on Nimbus Look and Feel customization?

Simply looking for some documentation. ...

can a java applet save files?

i just want to know if it is at all possible to make a java applet save a file to the web server it is being hosted off of. ...

Java static vs regular objects

While working on my previous problem, http://stackoverflow.com/questions/950636/java-jar-class-not-found-exception I noticed something odd. the class that can not be found is referenced from main. Now if i try to create an instance of the class like SysTray tray = new SysTray(); i get a class not found exception when i try to run th...

executeQuery() not returning.

Is there any condition under which PreparedStatement.executeQuery() does not return ro throw an exception ? ...

Expressions in hibernate criteria

Hi there, Let's say I have a persistent class Item with a quantity field and a price field. Is there a way to build a Criteria that calculates the sum of quantity*price? ...

SWT: Nested Layouts with ScrolledComposite exceeds available space

Hi, I want to build a Master-Detail layout for one of my applications using SWT. Container, Content, Sidebar and Part1 are Composite instances. Scrolled is a ScrolledComposite The desired layout is something like: +--Container-------------------------------------+ |+--Content----------------------++--Sidebar----+| || ...

Java Generics, extended Generics and abstract classes

I've got the following classes set up: public abstract class Process<T,S> { ... } public abstract class Resource<T, S extends Process<T, S>> { protected S processer; ... } public class ProcessImpl<EventType1, EventType2> { ... } public class ResourceImpl extends Resource<EventType1, ProcessImpl> { processer = new ...

Implementing a global lock in Java

Hi, I have a relatively simple (perhaps stupid) question regarding synchronisation in Java. I have synchronisation blocks that acquire locks on various objects throughout my code. In some scenarios, I want to acquire a global lock that subsumes every other synchronisation statement in my code. Is there a fancy way to do this in Java w...

Creating very large image files with BufferedImage, strange issues depending on compilation and computer

I'm attempting to create a very large image in Java like so: BufferedImage bi = new BufferedImage(58240, 1664, BufferedImage.TYPE_INT_RGB); obviously the image is very large. Now the issue I'm having is that it seems to work fine 100% on some computers but really slowly on others (and no this has NOTHING to do with specs). My most m...

sample java applications

.NET has codeplex for good sample applications to understand best practices. In Java, the first level of difficulty lies in finding a project with the frameworks you are interested to see implemented. In any case I've been unsuccessful in finding sample applications. SourceForge.NET has many, but a lot of them are incomplete. Many other...