Scenerio: I'd like to run commands on remote machines from a Java program over ssh (I am using OpenSSH on my development machine). I'd also like to make the ssh connection by passing the password rather than setting up keys as I would with 'expect'.
Problem: When trying to do the 'expect' like password login the Process that is create...
We logon users to Active Directory via LDAP using the Java LDAP API. We want to enhance our logon functionality to further check if the user is in a given AD group. Does anyone know how to do this?
Current code:
import javax.naming.*;
import javax.naming.ldap.*;
LdapContext ctx = null;
Hashtable env = new Hashtable();
env.put(Contex...
I'm trying to call a methond on a Java class from a Groovy class. The Java method has a String array as a parameter, and I have a collection of Strings in my Groovy class. How do I convert the Groovy collection to a Java String array?
Java Method:
public class SomeJavaClass{
public void helpDoSomething(String[] stuff){
}
}
Gro...
I'm trying to make a GUI in java, but JMenuBar has been giving me a hard time for two days. Can someone please tell me why it isn't showing up?
import java.awt.*;
import javax.swing.*;
import javax.swing.JPanel;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import java.util.Arrays;
import javax.imageio.ImageIO...
I'm viewing HTML in an SWT Browser widget. I am appending logging messages to the end of the content and would like to keep the bottom visible all the time. Currently, whenever I append text to the content, I first set the new text:
browser.setText(content);
And then I scroll down the Browser widget via JavaScript:
browser.execute("w...
Hi
I've been coding in .NET for several years, and more recently Actionscript. I need to get up to speed now on Java development.
I was hoping for some references to good books and blogs that will help me get up to speed in the Java gotcha's I'm likely to encounter. I'd like to know about the framework classes (collections, runtime, ...
In .net you have the ability to Response.End() in any context you want. Is there similar functionality in Java/JSP?
Thanks,
Sam
...
Hi, I'm writing a small Java GUI program, and I'm having some issues with Java not laying things out properly. I haven't done much Java GUI code lately, so I'm having trouble seeing where the problem lies.
final JFreeChart chart = createChart(dataset);
final ChartPanel chartPanel = new ChartPanel(chart, false);
chartPanel.se...
I currently work on a Java web application that has relies on a permissions mechanism to manage user content. This of course means that we need to manage users. Our current user management system is an in house system that manage info about users, groups, and user and permissions in an RDBMS. The system works but is a hassle to maintain....
I have some image constrain code that allows you to output to a MemoryCacheImageOutputStream, but I need to get this back into a BufferedImage, any suggestions?
...
This is a very basic question, I'm just not that good with Java. I have a Map and I want to get a list or something of the keys in sorted order so I can iterate over them.
...
I'm a senior-ish C# developer used to ASP.NET & IIS, but a project's come along for which I'll need to use Java/JSP and Tomcat, both of which are new to me. I've got a bit of experience with Java, but none with Tomcat or JSP, so I'm looking for a book ( or books) that'll help me get up and running with JSP and Tomcat quickly. (The proj...
As developer, I am often interested in new language feature that can make your life easier. For example, java 5 brought generics and annotations to the language, features that can definitely boost your productivity.
However, when I look back at close to a decade working on java platform, I find that the versioning related problems are t...
First of all, Hi to everyone, I'm here just to ask something maybe very simple, I'm working with Files, FileOutputStream and FileInputStream, But I just want to get/set a few props from the file, I mean, the owner the file, the permissions read/write, etc.
Looking around I found the classes FileDescriptor and FilePermission but I don't ...
public void exportUrlsToFile(String file, String urls) throws IOException {
String[] urlsArray = urls.split("\\s+");// split on one or more white space characters.
// create a fresh file
RandomAccessFile raf = new RandomAccessFile(file, "rw");
for (String line : urlsArray) {
line = line.trim();
if (line.isEmpty()) {// this ...
I heard from various sources that J2EE is highly scalable, but to me it seems that you could never scale a J2EE application to the level of the google search engine or any other large website.
I would like to hear the technical reasons why it is so scalable.
...
How can one quickly turn off all Log4J output using a log4j.properties file?
...
G'day all,
I have a console project where it is intended the user presses the keyboard direction keys (non-numeric keypad) to move an avatar. I am having difficulty coding to check for the press of these keys. In Pascal it was easy enough to use "readkey" and code, for example, for #80 for the down keypress. However, I am stumped how t...
We have a huge (old legacy java) code-base, where many files (around 5k) have System.out.println's. We are planning to remove them for cleanup/performance reasons. How can we write a script that will replace them without introducing any issues in the code? The script cannot blindly delete them as following case can be an issue:
if ()
...
I am asking this because I read Joel's The Perils of JavaSchools.
...