How to avoid swing program exit
My application, while in a specific condition, need to avoid program exit. In my application program exit can be done:
- through a menu bar menu item (exit): no problem to avoid exiting, I manage it with success.
- by clicking the standard red button in the applcation title bar (in other words the standard close button): here I need your help since I didnt' found a way to avoid the program closure.
To be clear, my application should avoid ( I mean avoid not delay) it's closure when is communicating (throgh RS232C connection) with other external devices, infact when the user select the exit item in main menù the application show a warning dialog with the mesage "you connot exit now, wait communication end". But I don't fiond a way to do the same whit close button, I can do something (i.e. showing the warnign dialog) creating a listener but I cannot "consume" the event so I'm not able to avoid the program exit.
Do you know a way to do it?
Thanks a lot for your help.
I tried with setDefaultCloseOperation(...) but seems have no effect one exit (exit in any case). I don't know if is a matter of SingleFrameApplication implementation (that I use since my project is crated with NetBeans swing wizard).
In any case at the end I found success using the SingleFrameApplication ExitListener interface, hereafter my solution (that works correctly):
public class FuelFEPApp extends SingleFrameApplication {
class ConfirmExit implements ExitListener
public boolean canExit(java.util.EventObject e)
boolean result= false;
if (mainThread.areChannelsCommunicating())
// There are communications running, avoid exit...
Object source = (e != null) ? e.getSource() : null;
Component owner = (source instanceof Component) ? (Component)source : null;
JOptionPane.showMessageDialog(owner,
(Object)"Communications running, you cannot exit application",
"Warning",
JOptionPane.WARNING_MESSAGE);
else
// No communications then exit
result= true;
return result;
public void willExit(java.util.EventObject e)
@Override protected void startup() {
FEPView= new FuelFEPView(this);
show(FEPView);
this.addExitListener(new ConfirmExit());
...
Similar Messages
-
How to debug a program exit in a Workflow ?
Hi experts,
How to debug a program exit in a workflow when the workflow is triggered ?
thanks in advance
regards
AshwinIn 4.6c I did this by creating a function module and a table (zsm50_debug). In the table are just two fields: User name (key), and a flag (yes/no).
The function module:
FUNCTION zsm50_debug.
*"*"Local interface:
*" IMPORTING
*" REFERENCE(Z_DEBUG_USER) LIKE SY-UNAME
DATA: z_exit,
z_debug.
CLEAR: z_debug.
DATA: starttime TYPE t,
currenttime TYPE t,
time_passed TYPE i.
starttime = sy-uzeit.
* Check if debugging is switched on
SELECT SINGLE debug FROM zsm50_debug
INTO z_debug
WHERE uname = z_debug_user.
* Debugging is switched on:
IF z_debug = 'X'.
* Not an endless loop, but it will continue after approx. 1 minute...
* Plenty of time to go to SM50 to debug the program and continue!
DO.
* Change the value of z_exit to 'X' to exit the loop an stay in
* debug mode.
IF z_exit = 'X'.
EXIT.
ENDIF.
* To prevent an endless loop (if the user forgot that debugging was
* switched on in ZSM50_DEBUG, time is measured to allow the program
* to continue after 2 minutes
GET TIME FIELD currenttime.
time_passed = currenttime - starttime.
IF time_passed > 120.
WRITE: / '!!!==========================================!!!'.
WRITE: / '!!!DEBUGGING STILL SWITCHED ON IN ZSM50_DEBUG!!!'.
WRITE: / '!!! Program was delayed by two minutes !!!'.
WRITE: / '!!!==========================================!!!'.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDFUNCTION.
This FM reads the table and checks if the flag is switched on. If so, it loops for two minutes. After that, it continues regardless. If not flagged, it continues immediately.
This way, you can debug any program that is running in the background.
In every method I program I add this FM right in the beginning. With authorization for SM50, I can then debug the program (in production it may be difficult to get the correct server, if there are more). -
How to start Swing programs without console
Hi, I'm working on Swing program, which can be started in the MS-DOS console by typing:
java myProgram
This works great, but for the end-users, I don't want them to see the ugly console that shows up and occasionally display exception code. How do I get the Swing program to start up without having the accompanying console?
Any help is appreciated. Thanks! :-)you can also package it in a jar and make it executable. There's a good discussion in the Jar Forum about how to do that.
-
Retrieve workflow container data in programming exit
I am trying to use a programming exit in Workflow in order to amend the task container for the receipients field of a "Send Email" step. The reason why we are not determining the receipients in the usual way is because we hold the receipients (amongst other data) in a separate Z* table - this needs to stay this way.
I created a class and copied method CHANGE_CONT_ELEMENT to base my altered code on. The method is triggered fine when testing the workflow. Here is what it now looks like:
method CHANGE_CONT_ELEMENT .
DATA: container TYPE REF TO if_swf_cnt_container,
if_swf_cnt_container,
cont TYPE REF TO IF_SWF_IFS_PARAMETER_CONTAINER,
name TYPE swfdname,
lh_wihandle TYPE REF TO if_swf_run_wim_internal,
l_exception TYPE REF TO cx_swf_cnt_container,
l_wiid TYPE sww_wiid,
w_container type ref to IF_SWF_IFS_PARAMETER_CONTAINER,
w_names type SWFDNAMTAB,
wa_names type line of SWFDNAMTAB,
w_value(30).
w_container = me->m_ctx->GET_WI_CONTAINER( ).
w_names = w_container->LIST_NAMES( ).
data: w_name type SWFDNAME.
w_name = 'TEST-NUMBER'.
TRY.
loop at w_names into wa_names.
CALL METHOD w_container->get
EXPORTING
name = wa_names.
endloop.
CATCH CX_SWF_CNT_ELEM_NOT_FOUND .
CATCH CX_SWF_CNT_ELEM_TYPE_CONFLICT .
CATCH CX_SWF_CNT_UNIT_TYPE_CONFLICT .
CATCH CX_SWF_CNT_CONTAINER .
ENDTRY.
ENDMETHOD.
Now w_names retrieves the names of the fields fine (including my "TEST" entry which I declared in the Workflow Builder), but the GET method causes a "CX_SWF_CNT_ELEM_NOT_FOUND" exception.
Is this the correct way to retrieve data out of a Workflow container within a WF programming exit? What am I doing wrong?
Kind regards,
Michael KochHi Michael, Paolo & Other experts,
I am trying to understand when, why and how to use a 'programming exit' in a SAP workflow.
(1) Did you figure out the solution to your problem?
(2) Is there any material / tutorial on use of a 'programming exit' in a workflow?
Thanks
Abaper -
Hi how to avoid nested loops in this program to improve the performence
Hi all
How to avoide the nested loops in this programing what is the replacement for the nested loops in this program coding......
LOOP AT itb_ekpo.
READ TABLE itb_marc WITH KEY
matnr = itb_ekpo-matnr
werks = itb_ekpo-werks BINARY SEARCH.
CHECK sy-subrc = 0.
FAE 26446 fin remplacement
itb_pca-ebeln = itb_ekpo-ebeln.
itb_pca-ebelp = itb_ekpo-ebelp.
itb_pca-lifnr = itb_ekko-lifnr. "-FAE26446
itb_pca-lifnr = itb_ekpo-lifnr. "+FAE26446
itb_pca-ekgrp = itb_ekpo-ekgrp. "+FAE26446
itb_pca-dispo = itb_ekpo-dispo. "+FAE26446
itb_pca-matnr = itb_ekpo-matnr.
itb_pca-werks = itb_ekpo-werks.
Recherche du libellé article
READ TABLE itb_makt
WITH KEY matnr = itb_ekpo-matnr
spras = text-fra
BINARY SEARCH.
IF sy-subrc = 0.
itb_pca-maktx = itb_makt-maktx.
ELSE.
READ TABLE itb_makt
WITH KEY matnr = itb_ekpo-matnr
spras = text-ang
BINARY SEARCH.
IF sy-subrc = 0.
itb_pca-maktx = itb_makt-maktx.
ENDIF.
ENDIF.
IF NOT itb_ekpo-bpumn IS INITIAL.
itb_pca-menge = itb_ekpo-menge * itb_ekpo-bpumz /
itb_ekpo-bpumn.
ENDIF.
Sélect° ds la table EKES des dates de livraisons et des qtés
en transit
CLEAR w_temoin_ar.
CLEAR w_etens.
LOOP AT itb_ekes
FROM w_index_ekes.
IF itb_ekes-ebeln = itb_ekpo-ebeln
AND itb_ekes-ebelp = itb_ekpo-ebelp.
IF itb_ekes-ebtyp = text-arn.
itb_pca-eindt = itb_ekes-eindt.
w_temoin_ar = 'X'.
ELSE.
Si c'est une qté en transit alors on recupere
la quantité et la date.
IF itb_ekes-dabmg < itb_ekes-menge.
itb_pca-qtran = itb_pca-qtran + itb_ekes-menge -
itb_ekes-dabmg.
ENDIF.
IF itb_ekes-etens > w_etens.
w_etens = itb_ekes-etens.
itb_pca-dtran = itb_ekes-eindt.
ENDIF.
ENDIF.
ELSEIF itb_ekes-ebeln > itb_ekpo-ebeln
OR ( itb_ekes-ebeln = itb_ekpo-ebeln
AND itb_ekes-ebelp > itb_ekpo-ebelp ).
w_index_ekes = sy-tabix.
EXIT.
ENDIF.
ENDLOOP.
S'il n'y a pas d'AR alors récupérat° de la date livraison dans EKET.
LOOP AT itb_eket
FROM w_index_eket.
IF itb_eket-ebeln = itb_ekpo-ebeln
AND itb_eket-ebelp = itb_ekpo-ebelp.
IF w_temoin_ar IS INITIAL.
itb_pca-eindt = itb_eket-eindt.
ENDIF.
itb_pca-slfdt = itb_eket-slfdt.
Calcul du portefeuille fournisseur à partir de la
qté commandée et la qté reçue
itb_pca-attdu = itb_pca-attdu + itb_eket-menge -
itb_eket-wemng.
Calcul du montant du poste
itb_pca-netpr = itb_ekpo-netpr * itb_pca-attdu.
IF itb_ekpo-peinh NE 0.
itb_pca-netpr = itb_pca-netpr / itb_ekpo-peinh.
ENDIF.
Calcul quantité réceptionnée.
itb_pca-wemng = itb_pca-wemng + itb_eket-wemng.
Calcul du retard en nombre de jours calendaires
Le calcul du retard ne doit pas prendre en compte
le jour de livraison
ADD 1 TO itb_eket-eindt.
IF NOT itb_pca-attdu IS INITIAL
AND itb_eket-eindt LT sy-datum.
Calcul du retard en nombre de jours ouvrés
CLEAR w_retard.
CALL FUNCTION 'Z_00_BC_WORKDAYS_PER_PERIOD'
EXPORTING
date_deb = itb_eket-eindt
date_fin = sy-datum
IMPORTING
jours = w_retard.
itb_pca-rtard = itb_pca-rtard + w_retard .
ENDIF.
ELSEIF itb_eket-ebeln > itb_ekpo-ebeln
OR ( itb_eket-ebeln = itb_ekpo-ebeln
AND itb_eket-ebelp > itb_ekpo-ebelp ).
w_index_eket = sy-tabix.
EXIT.
ENDIF.
ENDLOOP.
Recherche de la derniere date de livraison.
LOOP AT itb_mseg
FROM w_index_mseg.
IF itb_mseg-ebeln = itb_ekpo-ebeln
AND itb_mseg-ebelp = itb_ekpo-ebelp.
READ TABLE itb_mkpf
WITH KEY mblnr = itb_mseg-mblnr
mjahr = itb_mseg-mjahr
BINARY SEARCH.
IF sy-subrc = 0.
IF itb_mkpf-bldat > itb_pca-bldat.
itb_pca-bldat = itb_mkpf-bldat.
ENDIF.
ENDIF.
ELSEIF itb_mseg-ebeln > itb_ekpo-ebeln
OR ( itb_mseg-ebeln = itb_ekpo-ebeln
AND itb_mseg-ebelp > itb_ekpo-ebelp ).
w_index_mseg = sy-tabix.
EXIT.
ENDIF.
ENDLOOP.
APPEND itb_pca.
CLEAR itb_pca.
FAE26446 suppression parag. suivant
ELSEIF itb_ekpo-ebeln > itb_ekko-ebeln.
w_index_ekpo = sy-tabix.
EXIT.
ENDIF.
ENDLOOP.
Fin FAE26446
ENDLOOP.
Thanks in advance for all.....Hi
these are the performance tips
Instead of using nested Select loops it is often better to use subqueries.
SELECT * FROM SPFLI
INTO TABLE T_SPFLI
WHERE CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK'.
SELECT * FROM SFLIGHT AS F
INTO SFLIGHT_WA
FOR ALL ENTRIES IN T_SPFLI
WHERE SEATSOCC < F~SEATSMAX
AND CARRID = T_SPFLI-CARRID
AND CONNID = T_SPFLI-CONNID
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
The above mentioned code can be even more optimized by using subqueries instead of for all entries.
SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
WHERE SEATSOCC < F~SEATSMAX
AND EXISTS ( SELECT * FROM SPFLI
WHERE CARRID = F~CARRID
AND CONNID = F~CONNID
AND CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK' )
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
<b>Internal Tables</b>
1. Table operations should be done using explicit work areas rather than via header lines.
2. Always try to use binary search instead of linear search. But dont forget to sort your internal table before that.
3. A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
4. A binary search using secondary index takes considerably less time.
5. LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
6. Modifying selected components using MODIFY itab TRANSPORTING f1 f2.. accelerates the task of updating a line of an internal table.
Point # 2
READ TABLE ITAB INTO WA WITH KEY K = 'X BINARY SEARCH.
IS MUCH FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY K = 'X'.
If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
Point # 3
READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
Point # 5
LOOP AT ITAB INTO WA WHERE K = 'X'.
ENDLOOP.
The above code is much faster than using
LOOP AT ITAB INTO WA.
CHECK WA-K = 'X'.
ENDLOOP.
Point # 6
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
The above code is more optimized as compared to
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1.
7. Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
8. If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
9. "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to LOOP-APPEND-ENDLOOP.
10. DELETE ADJACENT DUPLICATES accelerates the task of deleting duplicate entries considerably as compared to READ-LOOP-DELETE-ENDLOOP.
11. "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to DO -DELETE-ENDDO.
Point # 7
Modifying selected components only makes the program faster as compared to Modifying all lines completely.
e.g,
LOOP AT ITAB ASSIGNING <WA>.
I = SY-TABIX MOD 2.
IF I = 0.
<WA>-FLAG = 'X'.
ENDIF.
ENDLOOP.
The above code works faster as compared to
LOOP AT ITAB INTO WA.
I = SY-TABIX MOD 2.
IF I = 0.
WA-FLAG = 'X'.
MODIFY ITAB FROM WA.
ENDIF.
ENDLOOP.
Point # 8
LOOP AT ITAB1 INTO WA1.
READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
IF SY-SUBRC = 0.
ADD: WA1-VAL1 TO WA2-VAL1,
WA1-VAL2 TO WA2-VAL2.
MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
ELSE.
INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
ENDIF.
ENDLOOP.
The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
LOOP AT ITAB1 INTO WA.
COLLECT WA INTO ITAB2.
ENDLOOP.
SORT ITAB2 BY K.
COLLECT, however, uses a hash algorithm and is therefore independent
of the number of entries (i.e. O(1)) .
Point # 9
APPEND LINES OF ITAB1 TO ITAB2.
This is more optimized as compared to
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
Point # 10
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
This is much more optimized as compared to
READ TABLE ITAB INDEX 1 INTO PREV_LINE.
LOOP AT ITAB FROM 2 INTO WA.
IF WA = PREV_LINE.
DELETE ITAB.
ELSE.
PREV_LINE = WA.
ENDIF.
ENDLOOP.
Point # 11
DELETE ITAB FROM 450 TO 550.
This is much more optimized as compared to
DO 101 TIMES.
DELETE ITAB INDEX 450.
ENDDO.
12. Copying internal tables by using ITAB2[ ] = ITAB1[ ] as compared to LOOP-APPEND-ENDLOOP.
13. Specify the sort key as restrictively as possible to run the program faster.
Point # 12
ITAB2[] = ITAB1[].
This is much more optimized as compared to
REFRESH ITAB2.
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
Point # 13
SORT ITAB BY K. makes the program runs faster as compared to SORT ITAB.
Internal Tables contd
Hashed and Sorted tables
1. For single read access hashed tables are more optimized as compared to sorted tables.
2. For partial sequential access sorted tables are more optimized as compared to hashed tables
Hashed And Sorted Tables
Point # 1
Consider the following example where HTAB is a hashed table and STAB is a sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
This runs faster for single read access as compared to the following same code for sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE STAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
Point # 2
Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
LOOP AT STAB INTO WA WHERE K = SUBKEY.
ENDLOOP.
This runs faster as compared to
LOOP AT HTAB INTO WA WHERE K = SUBKEY.
ENDLOOP.
<b>Reward if usefufll</b> -
Why do all the programs open when the mini is turned on, and how to avoid this?
why do all the programs open when the mini is turned on, and how to avoid this?
Open System Preferences > Users & Groups then select the Login Items tab.
Remove all apps listed there.
And check /Library/StartupItems
Open a Finder window. From the Finder menu bar click Go > Go to Folder
Type or copy paste the following:
/Library/StartupItems
Click Go then move all items from the StartupItems folder to the Trash. -
How to avoid time out error in abap program
How to avoid time out error in abap program
based on performance wise i want please helpTimeout occurs when a statement exceeds its time limit.To avoid this we need to tune the statements.
I can give give you few tips for tune a select stament.
1.The order of the feilds in the select statement should be same as the order of fields in the database table.
2.It is always advisible to use the key fields when you are using the where clause.
3. Sort the internal table while using the for all entreis statements.
4.Use index in where clause if necessary.
5.When you have a read statement user binary search but before this a sort statement should be there.
6. Check your program with the Tcode ST05 and check which statement takes much time based on that tune that. -
How do the Program exits in Workflow work?
hi all,
there is a Program Exit available in Workflow tasks...and it says
You can execute additional methods that you have programmed when predefined events occur. Add the ABAP classes that contain these methods. The ABAP classes added must support the IF_SWF_IFS_WORKITEM_EXIT interface.
now i want to use this program exits in my workflow...so that this program exit(which is basically a class) will take input from Workflow container and gives back processed data <b>back to workflow</b>.
so how to go about with these Program exits.
thanks,
subbahi
good
go throgh this links
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/82d03e23-0a01-0010-b482-dccfe1c877c4
http://help.sap.com/saphelp_nw04/helpdata/en/1a/6b023c3f6aaf08e10000000a11402f/content.htm
thanks
mrutyun^ -
Swing program - how to increase the size
Hi Friends,
I have made a simple swing program and it works fine.But I am not able to make the size(width,height) of the panel.Can someone please tell me how can i do that.Here's some part of my code...
public class Test extends JPanel
implements ActionListener {
//instance variable declared here
public Test() {
super(new BorderLayout());
//code for buttons,labels etc
JPanel buttonPanel = new JPanel(); //use FlowLayout
add(buttonPanel, BorderLayout.PAGE_START);
public void actionPerformed(ActionEvent e) {
//lots of code
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent newContentPane = new Test();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}Thanks for your help.OK sorry for that,in future i will post it in the right place.I tried doing this but didn't worked:
JPanel buttonPanel = new JPanel(); //use FlowLayout
// buttonPanel.setSize(300, 300);I was followin the FileChooserDemo example from this link:
http://java.sun.com/docs/books/tutorial/uiswing/components/examples/index.html#FileChooserDemo
And they used the pack there....now can you help please. -
How to run function(s) on ANY program exit?
I can easily do this when someone selects "Exit" from the program's menu, with this code:
AllSortsOfExitCode()
System.out.println("Ok, everything is wrapped up. Now we will end the program.");
System.exit(0);
BUT...how do you get this code to run when someone clicks the little X in the upper-right hand corner?
I can't figure out how to do that.
I need to override the class destructor or something, but I don't think Java has destructors in the classic sense. I found one 4-page thread about "Java destructors" but it was just an argument between a couple people -- I didn't learn anything from it.
Thanks,
MatthewCathInfo wrote:
BUT...how do you get this code to run when someone clicks the little X in the upper-right hand corner?
Thanks,
MatthewThe earlier replies cover the case you described above. But your thread title says something else:
How to run function(s) on ANY program exit?Answer - you can't. Power loss can't be handled. Shutdoen hooks can help with most other conditions, see
http://www.google.com/search?num=100&hl=en&c2coff=1&q=java+shutdown+hook&btnG=Search -
How to get the program where the User exit is use
Hi,
Could anyone let me know how to get the program which is using the user exit
EXIT_SAPLFMR4_002 .
Thank you.
Donny~You can do a where used on the functino module EXIT_SAPLFMR4_002 in SE37.
In this case, you user exit is called from a function module FMRE_FI_BELEG_CHECK. Which in my system, doesn't appear to be called directly. It could be called dynamically.
Regards,
RichHeilman -
Hi All,
I am using a third party tool which is internally calling System.exit sometimes and my application
got terminated most of the times.
It is happening always when i call a particular method of that third party tool.
Is there any way to catch or avoid the System.exit while using the particular method?
I need this urgently...Please kindly help.....
Thanks,
J.KathirThere's a fair bit to it, and you should refer to the appropriate java Tutorials. Bascially you create a .policy file and install a sercurity manager with:
System.setSecurityManger(new SecurityManager());The policy file grants a set of permissions to various "code sources", basically each codesource is a classpath entry. You could grant "AllPermissions" to your own code, and a more restricted set of permissions to the application you're running. But you can't subtract permissions, i.e. you can't say "this code can do anything except call System.exit().
I doubt this is going to provide you with a good solution. It's tiresome to set up, and when the client app called System.exit it would crash, which might not result in a clean status.
I'd consider if you should be using this client app in the same JVM, rather than creating a subordinate JVM using Runtime.exec. -
How to avoid short dump in ECC 5.0
Hi
Can anyone tell me how to avoid short dump in ECC 5.0
I'm told we can avoid program going to short dump, instead IT WILL GRACEFULLY EXIT..Hi
By implementing the code as for every unsuccess/failure conditions control has come out of the program. then only u can avoid dumps even though u code the not perfect functionality.
Regards,
kumar -
Running a Swing program from another program
I'm having what is most likely newbie problems since I'm relatively new to Swing programming. Basically my situation is this: I've got a program that looks at its command line parameters and either runs through a series of actions or presents a Swing GUI to allow the user to step through the actions one by one.
My problem is that I bascially don't know how to call (instantiate, declare, etc.) the GUI from my Java code. I tried implementing the GUI class with a runnable interface, but evertime I try to invoke the start on the interface I'm getting an error. I have a feeling I'm just missing something. The Swing GUI works fine if I call it on its own so it's the code the invokes it from the small command line processor that I'm goofing up somehow.
So to recap, I have a small Java app that I'm trying to call a GUI that I've built and can't seem to get the code right.
Any pointers to examples or explanation on how to accomplish the above are welcome.
Thanks,
EdThat the "2" is printed out immediately is as expected, but I don't understand why the JVM exits. The following is, AFAIK, a trimmed down version of what you are doing, and if you run it you'll see that the frame remains until you close it manually:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class ShowFrame {
public static void main(String[] args) {
AppFrame gui = new AppFrame();
gui.run();
private static class AppFrame extends JFrame implements Runnable {
public AppFrame() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
JButton btn = new JButton("Close");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AppFrame.this.dispose();
getContentPane().add(btn);
pack();
setLocationRelativeTo(null);
public void run() {
System.out.println("1");
this.setVisible(true);
System.out.println("2");
}Maybe someone else can shed some light over your problem... -
Hi All,
How to find out User Exit in particular program.
I mean if you have one profile, how to find is there any user exits in that program.
Appreciate if any body tel answer.
Thanks & Regards,
SubbuYou could try searching the main program for "userexit_"
This would give you a list of all the available user exits within the application.
For Customer exits, you could search SMOD with a short description ex: order in the F4 help. Another way is to search for CUSTOMER-FUNCTION in the main program. You can then navigate to the enhancement in the customer function and use the Z Program in the enhancement.
http://www.easymarketplace.de/userexit.php - has a complete list.
More specifically, in case you're looking for SD exits - http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm.
Maybe you are looking for
-
RFC Destination must same as Logical System
Dear All, RFC DESTINATION SHOULD BE THE SAME NAME AS Logical system.. plz explain me above statement. i have configured all thing for ALE(Vendor Transmission) in TCode BD14 i recieve two success message(in client 100) but i am not able to find VEN
-
1,000 menu items - each selection plays unique audio clip with same video
Hi all, We're familiar with playing different audio tracks based on a menu selection - but we have a large number of clips for this project... so, here's our question: A viewer of our 30 minute dvd throws it in the player and selects the city they li
-
Slide Show visible in FF but not IE
The widget works in other layouts I've tried but for some reason it does not display in IE. Firefox works fine but IE shows a Black Screen... all though the control buttons seem to work fine there is no image... Any help would be greatly appreciated.
-
IPhoto 8 freezes on startup, possibly due to Library data
I can't get iPhoto 8 to open any more on my iMac running Snow Leopard. The program starts up, shows an empty iPhoto window, and then the spinning wheel just spins and spins until I force quit. I suspect that this is because something has gone wrong
-
Hi all Hope someone can help me out on this one. I can start the server ok but when I try and look at http://localhost:8000/index.html I get this exception in the command window: java.lang.NoSuchMethodError at org.apache.catalina.connector.Respo