Java code to get server info
Hi,
How do I get the server info i.e server IP address etc using Java code. Pl. note that this is from the business layer and not from Front end.
thanks
hello Pfister,
I'll send you one article link , just go thru it ,
you can many examples from basics. if you get any errors just take that error no. which displayed , you can find the solution for that error in the link.
This link you can see one good example:
http://www.onjava.com/pub/a/onjava/excerpt/java_cookbook_ch18/index.html?page=5
Regards,
Varun
Similar Messages
-
Calling a javascript function from java code and getting tha value in Java
Hi,
I would like to call a Java script function confirmRemove() from Java code upon meeting a condition..
for example the code snippet is:
if(true){
// I want to call js confirmRemove() over here. And get the value of variable "answer" in this if block.
<html>
<head>
<script type="text/javascript">
function confirmRemove() {
var answer = confirm("Are you sure you want to Delete?")
</script>
</head>
<body>
<form>...Hi,
Back in 2003 I have used an Applet which contain java code and this java code was calling the java scripts ( different methods, DHTML etc..)
There was a component developed by NetScape called JSObject I am not sure it there is other third party component other then the JSObject
look at this article which shows how (based on JSObject)
[http://java.sun.com/products/plugin/1.3/docs/jsobject.html|http://java.sun.com/products/plugin/1.3/docs/jsobject.html]
Regards,
Alan Meio
London,UK -
How i can use ExportPDF in java code to get html files as PDF?
I need to use ExportPDF in java code to export my html to PDF and save that in my local system.
Yes, it's not a service for automating. Automating Acrobat is a possibility (though awkward), or there are server products.
-
Unable to create a folder through java code on weblogic server 10GR3
Hi,
I have java code which creates a folder and writes an XML file in to it.
File saveDirectory = new File(storePath);
if(!saveDirectory.exists()){
System.out.println("directory doesnt exists");
boolean isDirectoryCreated = saveDirectory.mkdir();
System.out.println("directory doesnt exist creating status :"+isDirectoryCreated);
This code works fine on my local weblogic server.Whereas the one installed on Unix box is not.
saveDirectory.mkdir() is unable to create a directory at the given path.
I feel there is some permission problems.
Please let me know what can be done.
Thanks,I have my Linux/Unix Admin either add me to a group that can do this or create one that can and add me to it.
If you command prompt can you manually do it now?
Best Regards
mseberg -
Java code to get user mapping info
I am writing a Java Servlet that needs to read the username and password to a user mapping system. Can anyone post a code example that will accomplish this? I have already been looking through the forums, so please don't post links to other forum entries.
hello Pfister,
I'll send you one article link , just go thru it ,
you can many examples from basics. if you get any errors just take that error no. which displayed , you can find the solution for that error in the link.
This link you can see one good example:
http://www.onjava.com/pub/a/onjava/excerpt/java_cookbook_ch18/index.html?page=5
Regards,
Varun -
Java code to get integer values from a gridLayout to put into an array?
I am writing a tictactoe game for a programming class. I made a grid of 3x3 layout and it alternates between putting an X when clicked and an O. I need to know how to retrieve what button off the grid was picked so I can create an array to check for win conditions...Or how to access the rowIndex and columnIndex of a selected button on the grid
Thanks in advance
Edited by: ryAnOnFire on May 23, 2010 6:10 PMimport java.awt.*;
import java.awt.Container;
import javax.swing.*;
import java.awt.event.*;
public class TicTacToe
JFrame theWindow;
JButton theButton;
Container thePane;
JTextField theText;
MyListener theListener;
public JButton[][] grid = new JButton[3][3];
public TicTacToe()
theWindow = new JFrame("Tic Tac Toe");
theWindow.setSize(250, 250);
String empty = " ";
theListener = new MyListener();
JFrame frame = new JFrame("TicTacToe");
Container thePane = theWindow.getContentPane();
thePane.setLayout(new GridLayout (3,3,5,5));
for(int i = 0; i < 3; i++)
for(int j =0; j < 3; j++)
grid[i][j] = new JButton(empty);
thePane.add(grid[i][j]);
grid[i][j].addActionListener(theListener);
JButton blankSpot = new JButton(empty);
blankSpot.setFont(new Font("Papyrus", Font.BOLD, 35));
theWindow.setVisible(true);
public static void main(String[] args)
new TicTacToe();
class MyListener implements ActionListener
String[][] spots1 = new String[3][3];
String[][] spots2 = new String[3][3];
static int playerTurnCounter = 0;
JButton[][] grid; // !! added
// !! added
public MyListener(JButton[][] grid)
this.grid = grid;
public void actionPerformed(ActionEvent e)
JButton jb = (JButton)e.getSource();
if(playerTurnCounter % 2 == 0)
jb.setText("X");
for(int i = 0; i < grid.length; i++)
for(int j = 0; j < grid.length; j++)
spots1[i][j] = grid[i][j].getText();
if((spots1[0][0].equals("X")))
JOptionPane.showMessageDialog(null, "TICTACTOE", "WIN", JOptionPane.PLAIN_MESSAGE);
//The problem seems to be occuring in the above block commented area
else
jb.setText("O");
jb.setEnabled(false);
playerTurnCounter ++;
Compiler Error:
C:\Documents and Settings\HP_Administrator\My Documents\TicTacToe.java:24: cannot find symbol
symbol : constructor MyListener()
location: class MyListener
theListener = new MyListener();
^
1 error
Tool completed with exit code 1
I'm just going to let you ponder over this as I do too...
I have no idea...my minimal experience with ActionListeners is doing me nothing for this one.
Edited by: ryAnOnFire on May 23, 2010 8:12 PM -
Java code to get the difference between two dates in days
Hi ppl,
I need to write a user defined function to get the difference between two date nodes, in days.Please help me out
regards,
PrashanthHi,
have a look at those two:
(How do I calculate the difference between two dates?)
http://joda-time.sourceforge.net/faq.html
Calculating the Difference Between Two Datetime Stamps
http://www.xmission.com/~goodhill/dates/deltaDates.html
Get difference in days
http://javaalmanac.com/egs/java.util/CompDates.html
Regards,
michal -
Hallo,
is it possible to get information for a single Tuxedo server, using ud32, instead of having the whole listing?
I mean, specifying some other parameters
Thank youyou cann try--
SRVCNM <TAB> .TMIB
TA_LMID <TAB> <LMID>
TA_SERVERNAME <TAB> <server name>
TA_SRVGRP <TAB> <server group>
TA_SRVID <TAB> <server id> -
Executing Java Code in ODI Procedure
Hi All,
I have following java code which i need to write on ODI procedure but i am not sure which technology to chose (Jython,Sunopsis API or Java BeanShell).
I tried to execute the procedure Jyhton with <% "Java code"%> but getting the error.Any boddy can suggest where i doing wrong.
<%
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.*;
import java.util.Hashtable;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
String userName = "HXXXXXX";
String CN1=null;
String Dis_Name=null;
String Mem_of=null;
String Mail=null;
String SGID=null;
File file = new File("C:/Project/ODI/LDAPID.txt");
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "LDAP://XX.if.YYYY.net:389/OU=XYZ,DC=ZZ,DC=if,DC=XYZ,DC=COM");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, new String("" + "\\" + userName));
env.put(Context.SECURITY_CREDENTIALS, "");
DirContext ctx = null;
NamingEnumeration results = null;
ctx = new InitialDirContext(env);
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
results = ctx.search("", "(objectclass=person)", controls);
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
while (results.hasMore())
SearchResult searchResult = (SearchResult) results.next();
Attributes attributes = searchResult.getAttributes();
Attribute attr = attributes.get("cn");
String cn = (String) attr.get();
CN1=(String.valueOf(attributes.get("cn")));
Dis_Name=(String.valueOf(attributes.get("displayName")));
SGID=(String.valueOf(attributes.get("userPrincipalName")));
Mem_of=(String.valueOf(attributes.get("memberOf")));
Mail=(String.valueOf(attributes.get("mail")));
bw.write(CN1 + " || " + Dis_Name + " || " + SGID + " || " + Mail);
bw.newLine();
bw.close();
results.close();
ctx.close();
%>
I am getting following error.
The application script threw an exception: java.lang.NullPointerException BSF info: CODE_JAVA at line: 0 column: columnNo
Please suggest what went wrong with the code.
Thanks
RegardsIn Jython you don not need to declare the type so String userName = "HXXXXXX"; should simply read userName = "HXXXXXX" . Lots of your code need to be rewritten to work with Jython if you choose that as your technology.
-
How can I write java code in web dynpro to show KM content document?
Dear all developer
SDN developer who have any easy example java code for get and show KM content documents(documents/com.xx.km/.). We are develop this project by Netweaver Studio 7.0 and using WEB Dynpro application.
Thank for all comment and advice.
Jumnong BoonmaHi
i dont have the exact code but yes..i can refer to the link for Web Dynpro applications for the Portal.
[http://help.sap.com/erp2005_ehp_03/helpdata/EN/42/fa080514793ee6e10000000a1553f7/frameset.htm]
Here look out for Absolute Navigation.
Hope it helps...
Thanks.. -
Can MySQL triggers or storedprocedures(callbacks) call java code?
I have to store the DB tables in the server side(i.e cache it) If someone updates the Data Base , The Data updates must be reflected in the cache in the server side. so how callbacks form the DB can be make to a java code in the server side.
i am using Ms SQL and web logic server.
or which DB and APP server can support it?Do the update request from the client via an java application(servlet,etc.) to an server application. The server application work with the db (via jdbc) and can so update the cache if any db update occurs.
-
Java applications on EP server
Hi EP Experts,
I would like to know following things.
1. How do I migrate Java applications on Portal server? (one way using JAVA PDK)
2. What are the different problems that are faced during migration of Java code to EP server
3. Do we need to import specific libraries that are used specific for Java applications and are not available with WAS/EP?
If any one has similar migration experience please share the problems that are faced and if possible solutions you got for any.
Thank you,
Chintamani ChitnisHi,
Check this document
http://help.sap.com/saphelp_erp2004/helpdata/en/88/bdfc3f48ecc742e10000000a1550b0/frameset.htm
Regards,
Ganesh N -
Get cars info by their license plate
Hi, I urgently need a code to get car info by writing its licese plate number.
Can someone help me?
Thanks
BrandonThis has nothing to do with AIR or whatever programming language/platform. Its also a violation of privacy and probably illegal to make. Only way you can make it is by having access to license plate databases and I think only police has those and won't be there to give it to you!
-
Display current day using java code
I want java code to get current day for the month.Please help me
anie wrote:
Sorry,but i did't understand what you are trying to point?????Im trying to point out that there is loads of examples of this to be found on the web(And it can easy be found by using Google(<-- a searchengine)). And it seems to me that the topic starter rather wants someone else to do the searching, or provide example code, rather than doing it him/her self. (S)he is not the first person to want to do this with other words. Im rather sure about it. -
How to get the Weblogic Server Id from within java code
I would like to log which server (among a cluster) a certain job is running on. Is there a way to get the server id from within Java code (this code is in a session bean if that is relevant.)
By server id I mean the "Name" column in the summary of servers on the weblogic console.
Thanks,
kenUse the two entries close to the bottom of the page: "list WebLogic
MBeans:listMBeans.jsp
display MBean attributes and operations:showMBean.jsp"
Nils
Anatoly wrote:
>
Cameron,
That page has these items on it:
which one do you think helps with my issue?
Misc WebLogic examples
LongRunningTask
Execute tasks in parallel using WebLogic Execute Threads
Weblogic stats (5.1)
Reload Servlet(s) programmatically (5.1)
Network classload from WebLogic:using reflection,or the launcher
Weblogic 5.1 debugging properties
Seppuku pattern readme
Using dynamic proxies to intercept EJB invocations (6.1)
list WebLogic MBeans:listMBeans.jsp
display MBean attributes and operations:showMBean
Thanks to Marcelo Caldas for filter by type option and nice UI!
Using com.sun.jdmk.comm.HtmlAdaptorServer with WebLogic 6.1
Cool
EJBGen
Dimitri
back
"Cameron Purdy" <[email protected]> wrote in message news:<3c7a745d$[email protected]>...
JMX ... see http://dima.dhs.org/misc/ for some info on JMX in Weblogic.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"Anatoly" <[email protected]> wrote in message
news:[email protected]..
Does anyone know who to get the managing server URL's port
from within the EJB code running on Weblogic 6.1?
The URL port is not default (not 7001), but when creating
initial context, I am not specifying the URL in properties.
Due to that, trying to the the PROVIDER_URL property from
environment does not return anything.
Appreciate any responses.
-Anatoly
============================
[email protected]
Maybe you are looking for
-
Issue in displaying Overall Result of a formula variable
Hi All, I have a fields as Years of Sevice in my report. This is defined as char. I am bringing this in the report by creating a calculated key figure and then using a formula variable that is defined as the replacement path of the Years of SErvice.
-
ALV for fields from multiple tables and make them editable
Hi, I am working on a forecasting report. We have created few custom table e.g. store forcaset detail for whole year month wise. tables are say sales data, budget data, forcast data etc. Now i need to make a report based on monthwise based on above m
-
I've got some DSLR footage filmed at different frame rates (25 and 50) and as a result also different sizes (1920 x 1080 / 1280 x 720) compressed as H.264.... can anybody advise me as to what format the footage would edit best in (fastest render time
-
Workflow duplicated during PO approval
Hi, I have an issue in production system where for a particular cost center and user the same workflow is triggering twice to the approver, Like for Cost center"XXXX" Level 1 Approver is 'AAAA', Workflow looks like this - Buyer - > Cost center Level
-
Will time machine work when the lid is closed on my macbook?
I was on then I closed the lid. Its connected to a USB hard disk designated for time machine.