answerstu

java - JavaFX Displaying properties in controls

I'm working through myself Oracle's JavaFX tutorials. After doing Swing for many years (a long time ago) I'm fascinated by the new smart features, incl. properties. I was surprised to see that these examples (e.g: https://docs.oracle.com/javafx/2/ui_controls/table-view.htm) don't use them in a way what I believe to be "proper".The example creates a Person class with properties as fields:public static class Person { private final SimpleStringProperty firstName; ...But the getters are not for the properties, but for their values public S...Read more

java - USB bulkTransfer between Android tablet and camera

I would like to exchange data/commands between a camera and an Android tablet device using the bulkTransfer function. I wrote this Activity, but the method bulkTransfer returns -1 (error status). Why does it return the error?public class MainActivity extends Activity { private TextView text; private int TIMEOUT = 1000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text = (TextView) findViewById(R.id.txt); usbTest(...Read more

How to static-import enums residing in separate files in Java?

Basically, here's the gist of my code:// File: ShapeColor.javapackage mypackage;public enum ShapeColor{ MAUVE, PURPLE, VIOLET;}// File: ShapeSize.javapackage mypackage;public enum ShapeSize{ TINY, SMALL, MEDIUM, LARGE, HUGE, COLOSSAL;}// File: Shape.javaimport static mypackage.ShapeSize.*;import static mypackage.ShapeColor.*;public class Shape{ private ShapeSize size; private ShapeColor color; public Shape() { this(ShapeSize.MEDIUM, ShapeColor.PURPLE); } public Shape(ShapeSize ss, ShapeColor s...Read more

java - How to check if adview currently has ad running?

I currently have an adView that is launched whenever an activity is launched. I'd like to check if that adView already has an Ad running and if it does then it continues running that Ad , however, if it does not have an Ad running then I would like to load and Ad intho that adView.This is the code currently:private AdView mAdView;mAdView = (AdView)view.findViewById(R.id.adViewEvent); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest);...Read more

java - 'Must Override a Superclass Method' Errors after importing a project into Eclipse

Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing the error The method must override a superclass method.It may be noteworthy to mention this is with Android projects - for whatever reason, the method argument values are not always populated, so I have to manually populate them myself. For instance:list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { //These arguments have their c...Read more

android - Can't start Eclipse - Java was started but returned exit code=13

I am trying to get my first taste of Android development using Eclipse. I ran into this problem when trying to run Eclipse, having installed version 4.2 only minutes ago.After first trying to start Eclipse without any parameters to specify the Java VM, I got an error message saying it couldn't find a Java VM called javaw.exe inside the Eclipse folder, so I found where Java was installed and specified that location as the parameter in the shortcut's target. Now I get a different error, Java was started but returned exit code=13.Similar questions...Read more

java - Could not publish to Tomcat 7 server NullPointerException

Eclipse 4.4.2v2015024-1700I'm trying to launch a local Tomcat 7 server that's for an older project I haven't modified in a couple of years. I was able to get the server up and started this morning, then I made some code changes that required a newer version of a shared library, so I updated the relevant POM with the new version number. I shut the tomcat server down, then tried to restart it and it's been stuck in this perpetual error of "Could not publish to the server.java.lang.NullPointerException"Things that I've tried: add/remove the module...Read more

java - Missing Javadoc in Eclipse for JRE 9

Eclipse Oxygen.2 (4.7.2) fails to load standard javadoc when I select my JRE 9 install as default JRE.Is that a bug?When I switch back to JRE 8 it works.EDITSo, I was a bit short on that one, let me explain. When I select a JRE for Eclipse (Preferences > Java > Installed JREs), should it be a JRE9, a JDK9, a JRE8 or a JDK8 location, when I Edit it, I can see in the jrt-fs.jar (9) or in each separated jar including rt.jar (8) a Source attachment location (empty for JRE which is normal) and Javadoc location (official HTTP URL).That's why I expect...Read more

java - How to create a dynamic object based on different entity

I have created two fetch methods to get Invoice Detailsto get Sales order detailsI got the result set as list.I need to create common method to send an email (the email method should be generic) by passing the invoice, Sales, etc. arguments to send an email, without creating a common entity is there any other way to solve this.Can any one help me out? List<Tableinvoiceheader> inv_List=rpc.getInvoiceDetails(); List<TableSalesorder> sales_List=rpc.getsalesDetails(); --email trigger method mailObj.sendemailMessage(From,to,su...Read more

java - Testing Liferay multiple user login using JMeter

I need to test our Liferay application. In researching it sounds like JMeter is the way to go but following this example -> http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdfI don't really see a way to pass in more then one account. I have a list of several 1000 accounts, I want each thread to log in using a unique account to simulate the load (Just log in 1000 at a time, wait a minute, log in another 1000, etc, then kill when I hit the max log in that we are testing)How, using the technologies I have/know (Java) can I pass in an...Read more

java - Unable to run Cloudfoundry UAA on local machine

I tried to follow the instructions in https://github.com/cloudfoundry/uaa, namely cloning the github repository and then executing the gradlew run command. I am running this on a Windows 10 system that has Java 1.8 installed. However, I run into the following error at around 97% of the execution of gradlew run. org.codehaus.cargo.container.ContainerException: Deployable [http://localhost:8080/cargocpc/index.html] failed to finish deploying within the timeout period [120000]. The Deployable state is thus unknown. :cargoRunLocal FAILED :cargoR...Read more

java - Automating movement on a webpage

Well, I'm kinda new to mobile app development, but I have a fair amount of experience with Java. I stumbled upon CodeNameOne and thought I'd try to make an app based on "It's Learning". Unfortunately this site won't let me get straight to the logon page without going through the main portal first. So here's my question:Is there any way (in CodeNameOne) to automate navigation on the web in the background and get information from the site, such as login and the newsfeed, then send data from the app and to the web page?(Something like the way Html...Read more