Java is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to byte code and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.

learn more… | top users | synonyms (6) | java jobs

0
votes
0answers
3 views

CordovaWebView messes up with onBackPressed method in android

As title says CordovaWebView and onBackPressed in android in combination are giving weird results. I have hybrid app. My main activity has DrawerLayout and CordovaWebView. My onBackPressed: ...
0
votes
0answers
6 views

Send a continuous stream of data efficiently to a web server in java

I have a Web Server (WebLogic) and I want to send a continuous stream of data (A Json object) to this server. In other words I want to send the same json object again and again with the least time ...
0
votes
0answers
12 views

Spring MVC NullpointerException

I keep getting all the time NPE when I try to wire a bean to a class thats not the HomeController(created by default by Spring). Should i change something in any of the xml so all mi classes can use ...
0
votes
0answers
9 views

Getting exception java.lang.NoClassDefFoundError : org.aspectj.weaver.patterns.IScope

I am running a Web Portlet project with Spring MVC framework. I am trying to do Auditing with the help of AOP. but when i am running the application i am getting 2 exceptions at different points... ...
0
votes
0answers
27 views

How to implement TimSort in java? [on hold]

Just out of curiosity, I was trying to implement TimSort in java. I used the following sample code. ...
0
votes
1answer
16 views

Invoke sendMessage method from second activity

I'm doing some dev for a Chromecast sender app, and I have this method in my MainActivity class: public void sendMessage(String message) { if (mApiClient != null && mHelloWorldChannel ...
0
votes
3answers
32 views

Java - Unable to create a file

I am in a Linux Envirnomnet. I am also using Netbeans. Here is my code below: import java.io.*; public class myFirstJavaProgram { public static void main(String[] args) { File file = new ...
2
votes
2answers
48 views

Why are arrays in Java restricted to “int” sizes? [duplicate]

For example, I get error "Cannot convert from long to int" while trying following long size = 32; int a[] = new int[size]; Java restrict array size to int, which limits me to create max ~2 billion ...
0
votes
0answers
10 views

Testing a method which calls private void method inside using mockito

I want to test a method which internally calls a void method. Below is the code public String process(MKSConnectionParams mksConnectionParam, IProgressMonitor progressMonitor) throws Exception { ...
0
votes
1answer
22 views

Best way of creating a Comparator that reverses order

This may seem like a dumb question, but I'd like to inquire about the best way to sort in reverse order a sortable structure (any kind, could be List) of a class MyClass that doesn't implement ...
-1
votes
2answers
17 views

How can I format in java?

This is what I currently have so far public String toString() { return this.make + " " + this.model + " " + this.year + " $" + this.price + " " + this.mpg; } I need to format it to ...
0
votes
1answer
6 views

Getting java.rmi.NoSuchObjectException while invoking a method on remote object

I know such kind of questions have been asked before.But my problem is little different. I have 2 services , A and B.A uses methods of B via RMI. B exports itself via below 3 statments:- Remote stub ...
0
votes
0answers
3 views

Mybatis query giving error in spring

SELECT A.FILE_ID as fileId ,A.APP_VER_SEQ_NO as appVersion FROM PRE_DATA A WHERE 1 = 1 <if test="appId != null"> AND APP_ID=#{appId} </if> <if test="appName != null"> AND ...
0
votes
0answers
8 views

Issue with BigeDecimal value deserialization

I am using jsefa 0.9.2 to de-serialise CSV data. During this I encounter a issue with BigeDecimal data. When you pass letter between numbers. de-serialisation just ignore the values after letter and ...
0
votes
2answers
18 views

Java object instantiation reading a file

I am new to java. I have a class as following import java.io.*; class Lexer { private static final int KEYWORDS = 11; private StreamTokenizer tokenizer; private String punctuation = ...
-8
votes
0answers
21 views

How to write a java program to remove comments from a java file and store it in another file? [on hold]

I need a java program that uses buffers or streams to read a java file and remove all the comment lines from the file and store it in another file.I hv a sample code but i need other methods to do the ...
0
votes
1answer
7 views

Java OpenCSV Writing Result Set - End of Line / Row

I'm trying to export a sql resultset to a comma delimited csv file using opencsv libary. However when I pass the result set to the writeAll function, all works well excepct for the file it generates ...
0
votes
0answers
3 views

Will generating a certificate with the unlimited strength security policy files require those files on the device which will use that certificate

I'm trying to make an https server for Android. I used the following command to generate the certificate: keytool -genkey -trustcacerts -keypass pass -keystore keystorenew.bks -storepass pass ...
0
votes
0answers
8 views

JavaCV in Android- Installation Problems

Hello I am having problems installing JavaCV in Android. I made an app using certain classes from the JavaCV API. I tried running it; it didn't work. I have extracted all the .so files to the lib ...
0
votes
1answer
5 views

Stuck in infinite loop after executing oracle export in java?

I have been searching through net, how to make proper export using exec in java. Here is the code I am use for that: private static void execute(String string) { // TODO Auto-generated method ...
0
votes
0answers
3 views

Talend ETL Job Error in tOracleOutput Component

I am a newbie to TalendETL and am using Talend Open Studio for Big Data version 5.4.1 . I have developed a simple Talend ETL job that picks up data from a csv file and inserts data into my local ...
-4
votes
5answers
35 views

Java error in eclipse

Whenever I run this code: package jmv; public class euler3 { int x=0; public static void main(String[] args) { for (int x=0 ; x < 6008 ; x++){ if(6008 % x == 0){ ...
0
votes
0answers
3 views

How do UserTransaction and TransactionManager relate to each other in JTA

I'm looking at the JTA functionality and I'm not quite understanding the relation between the TransactionManager and a UserTransaction. Is it like a TransactionManager is only useful in the context ...
0
votes
4answers
27 views

Print an array in Java

I am trying to print a multidimensional array filled with *s. here is the code. String[][] star = new String[10][10]; for(String[] row: star) { Arrays.fill(row, "*"); } ...
0
votes
2answers
40 views

Android SimpleDateFormat Parsing Error

I know there are many other questions on stackoverflow that deal with SimpleDateFormatter in Android or Java, but I have been unable to find any questions that help me answer my own question. I have ...
-1
votes
1answer
11 views

How to identify programtically that all concurrent threads have stopped to perform a post action

Scenario: Consider 4 parallel/concurrent threads are running. When all of threads stop, Need to send an email to let team know that these threads have stopped. Problem to solve: Only issue here is ...
0
votes
0answers
12 views

Run SSH command from RedHat 5 to Ubuntu 12.04 failed when using remote environment variable

I have 2 Redhat machines and 2 Ubuntu machines . Assume that I have already Maven installed on all machines (Maven install as specifice user , not system-wide),so I can run command which mvn to show ...
-4
votes
0answers
21 views

Best way/class to get data from a file using java [on hold]

I am new to Java and facing difficulty in coding. Anyone can suggest a class/code with which i want to capture date stamp from a log file right before a Keyword and save it in variable. Following is ...
0
votes
0answers
13 views

Best easy to use encryption for golang/java communication

I need to be able to get and post arbitrary text to and from some servers, which in some cases may not be running https. I would use public private keys, and be able to both encrypt and decrypt in ...
0
votes
0answers
6 views

Using Maven Archetype Generate in the same Directory

Is there a way to run mvn archetype:generate and target the current directory instead of creating a directory from the artifactId? The plugin supposedly takes a basedir parameter, but passing in ...
0
votes
5answers
46 views

super() method not giving error when no parent class is defined

class child { child() { super(); System.out.println("Hello"); } public static void main(String arg[]) { child obj=new child(); } } In this code when I ...
2
votes
3answers
24 views

Declaring a new data type for DNA

I am involved with biology, specifically DNA and often there is a problem with the size of the data that comes from sequencing a genome. For those of you who don't have a background in biology, ...
0
votes
0answers
10 views

JOptionPane and IF…help please [duplicate]

im trying to show a message if the input is "e" or "E" but the message is not popping up. I am just learning about programming so please help me out...and thanks in advance import ...
0
votes
1answer
26 views

Global method to prevent app from crashing?

I am trying to add a method in my parent activity that all my activities are inheriting from. I want the method to catch any errors that have not already been handled so the app does not crash. ...
0
votes
0answers
7 views

How to change MySQL characterset on Mac?

My MySQL version is "Ver 14.14 Distrib 5.6.19, for osx10.7 (x86_64)" I am trying to set "Server characterset" and "DB characterset" from latin1 to utf8. I googled it, but I cannot find [client] in the ...
0
votes
1answer
14 views

Trying to read JSON (using GSON) into an Object which has another object as a field.

so I am using Google's GSON library for making sense of JSON strings. I have it working where the Object I am saving is User with a statement like : User user = gson.fromJson(string, User.class), ...
0
votes
0answers
23 views

Why can't I pass new object to setOnItemClickListener to bind events?

As I tried to dynamically add and remove events to listview, I would: // Bind action1 with the listview click event. listview.setOnItemClickListener(null); // remove the previous binded events: ...
0
votes
0answers
2 views

How do I config virtual directory to Jetty9

I have a web application(test.war) in jetty 9. Context path is 'test'. I want config 'test/thumbnail' to be a virtual directory,The 'test/thumbnail' is a external directory,and exist in ...
0
votes
3answers
31 views

org.json.JSONException: No value for trying to parse a JSON

Hello everyone I'm trying to parse a json but the text is never displayed! in the logcat it Says this: 06-24 23:28:22.681: W/System.err(6271): org.json.JSONException: No value for ...
1
vote
2answers
24 views

Java: Client automatically connecting to server when internet is available

I have made a client-server application which can connect over the internet. I have hard coded in my client the server's IP which is fixed. My question is that I want a way that will not take a lot ...
-5
votes
0answers
12 views

I have seen examples of creating custom annotations, but I am searching for example of custom annotations with custom producers as in Java EE. [on hold]

I have seen examples of creating custom annotations, but I am searching for example of custom annotations with custom producers as in Java EE.
1
vote
1answer
14 views

Android Java: getText can't read superscript font

I used tv.setText(Html.fromHtml(char1 + "2")); and able to set the text to have "2" as superscript. However, when I CharSequence char1 = tv.getText(); The "2" is read as normal character, not ...
1
vote
0answers
15 views

Hibernate change some line of code get APPARENT DEADLOCKS

I using Oracle database and my java application use Hibernate 3.3.2 to interact with it. I alway use code like this to connect to DB public void method() { Session session = ...
2
votes
3answers
55 views

using “this” in java [duplicate]

Hello i'm still kind of new to java.. I get the concept of "this" when it comes to instance variables but when i use it in a constructor with no parameters i get a little confused. So my question is ...
0
votes
1answer
46 views

Not getting array output?

I have a simple program that reads a txt file and outputs employee demographic data to the console. As I go through the debug, the array is populated with data but I don't get a return from the ...
0
votes
2answers
39 views

for loop using lambda expression

My Code: List<Integer> ints = Stream.of(1,2,4,3,5).collect(Collectors.toList()); ints.forEach((i)-> System.out.print(ints.get(i-1)+ " ")); out put: 1 2 3 4 5 my question is why i ...
0
votes
0answers
17 views

Design pattern for encoding a table of data

I have to write code which will query a web service to retrieve data. The params for the webservice call are dependent on many values, but they can be nicely represented in a table: Image link I ...
0
votes
1answer
10 views

FTPClient (apache.commons) isn't uploading or deleting my files

The below code gets down to the "Start uploading file" and "Trying to delete file from server..." and then never uploads nor delete the file if calling "onFileCreate" or "onFileDelete", also doesn't ...
-4
votes
0answers
17 views

Can we have the class files of jvm javac java [on hold]

Can we have the class files of jvm javac java. When we use throws statement whom to inform that the method throws exception? what subsequest action will be taken place
0
votes
0answers
20 views

Interactive UI with dynamic areas

Going to make a pretty statistic part for my app and saw a pretty good looking UI (see below). What I'm asking is what's the approach? I have a few ideas, for example drawing multiple ImageButtons ...